T O P I C R E V I E W |
Sebas88 |
Posted - 05/30/2013 : 10:24:19 AM Origin Ver. and Service Release (Select Help-->About Origin): Operating System:
Hey,
I need some help with an own cos^2 fit-function. Maybe somebody can talk german cause i come from Germany.
I have measured values and i have to create a fit. The function is: A*cos^2(beta+phi)+B
How do I start? What do I have to do? It's my first time to make an own fit :/
If you need more information, just ask me.
And how I can stretch fits that they cross the x or y- axes?
|
9 L A T E S T R E P L I E S (Newest First) |
m_n2011 |
Posted - 02/06/2015 : 01:46:34 AM Hi. I need some help with my data fitting. I have actually fitted my data with a Sine graph, but now I need to compare this fitted graph with my original formula in Physics and get some idea about "L" which is my unknown in the below equation:
My original formula in Physics is: y=A*cos[((4*pi*L)/lambda)+phi]+B Lambda is my wavelength in the below data.(Independent variable=lambda, dependent variable=y=Intensity). A, phi and B are parameters/constants only.
Would anybody help me with this conflict?
|
greg |
Posted - 01/22/2014 : 09:35:11 AM Period is just one of the parameters of the SIN function fit. (Fitting with SIN is identical to fitting with COS introducing only a phase offset.)
I was not working with your data. I was working with a digitized version of your data which includes some error so I would not get the exact same results as you. |
m_n2011 |
Posted - 01/16/2014 : 10:27:51 PM Hi Greg
Thanks for your great help.
I have some silly questions : 1- would you please tell me how did you calculate period from the fitted curve? My main issue now is finding the period. Because I have to fit my data with the f(x)=a+b*cos(4*pi*d*x+c)+e, which a,b,d,c and e are unknowns and only the parameter "d" is very important to calculate which comes from the period and has the dimensions of length.
Also, your R^2 is much better than mine, would you please tell me in detail that how did you fitted my data that resulted in better R^2? I think I have some issues in determining the initial values for parameters.
I appreciate your help. |
greg |
Posted - 01/07/2014 : 09:33:17 AM I used our digitizer to capture your data and fit it with the SIN function (same as COS but with a phase shift) and the fit looked just like yours. My results: Reduced Chi-sqr = 1.62821785445E-4 COD(R^2) = 0.44193549757369 period : 20.71803±0.5466
This captures pretty well an underlying low frequency oscillation in the data, but you might be more interested in the the peaks which occur at about 4 times this frequency.
So I fixed the 'period' parameter at about 1/4 the current value of 20.72 (5) and fit until converged again and then unchecked the fixed box and continued to new result of: Reduced Chi-sqr = 2.5131743454E-4 COD(R^2) = 0.13862055575261 period : 4.98097±0.05717
The higher frequency had a slightly poorer Reduced Chi-sqr, but a much worse COD(R^2) so I would say your first effort is a better fit.
I also defined a function to do both (this time using the cosine):
y=y0+A1*cos(pi*(x-xc1)/w1)+A2*cos(pi*(x-xc2)/w2)
and initialized the parameters using the values I got from the first two fits. My results: Reduced Chi-Sqr = 1.58984224263E-4 COD(R^2) = 0.46464841925531 periods : 21.25316 ± 0.585 and 4.86189 ± 0.038
Only a slight improvement over the initial fit. |
m_n2011 |
Posted - 12/30/2013 : 01:22:45 AM Hi. I am having trouble with my curve fitting. I have an Intensity signal versus wavelength which I need to do a cosine fitting with the equation I(x)=A+B*cos(4*pi*d*x)on it (A,B,d are unknowns). I tried it myself with the help of the previous comments, but I am not sure if it is the best fit that I can get. I appreciate if anybody can help me with this. I have uploaded the signal and its curve fitting.
|
Sebas88 |
Posted - 06/10/2013 : 07:48:45 AM YEAH it works! THX THX THX! |
meili_yang |
Posted - 06/04/2013 : 11:30:52 AM Hey, I read the data from your image using Origin 'Digitize Image' tool, and get a fit in the following. Hope you don't mind.
I change your fitting function to "A*cos(n*x+phi)^2+B" by adding another parameter n, and set initial value to be: A: 3400 phi: -0.40 B: 0 n: 0.02.
I set B to be parameter. You might also try to set B as constant, and play around with other values for B to make the Standard Error smaller.
These initial values are calculated based on the data. A is determined from the maximum of y. B should be close to zero. n and phi can be calculated by reading two data points, for example: n*20+phi=0 (x=20) n*100+phi=pi/2 (x=100)
You can edit your function without creating a new one. Click on the green lock shape button on the left top of your graph, choose 'Change Parameters' to open 'NLFit' dialog. In the middle there are a few tools. The first one 'f(x)' is edit the function.
Hope it can help.
Meili OriginLab |
Sebas88 |
Posted - 06/01/2013 : 06:51:02 AM Hey thanks :)
1 step closer to the perfect fit. Now I get this one:
But I need a perfect fit :/ I followed the video step by step and your hint. What is the mistake? |
meili_yang |
Posted - 05/30/2013 : 3:56:27 PM Hi,
I can clearly understand your English. And it's simple to use User Defined Fitting Function too. So no worries.
You can watch this video to see if it helps. http://www.originlab.com/Index.aspx?go=Support/VideoTutorials&pid=1172
I do have a question. So what's your independent variable? You need to set that as x and you measured value as y.
Suppose y is your dependent variable, and beta is your independent variable, A, phi, and B are your parameters, you can set your formula to be
y=A*cos(beta+phi)^2+B
Hope it can help.
Meili OriginLab |