How Do I Use Functions for Curve Fitting in Origin Software?

Click For Summary
Curve fitting in Origin software requires defining functions to accurately model data. The provided functions, I(x)=I0-I1cos(x-x0) and I(x)=I2+I3cos(x-x1), aim to fit the lowest and highest parts of the curve, respectively, with x0 and x1 representing the x-values at these extrema. It is suggested to avoid non-linear fitting due to potential convergence issues, and instead, a linear approach using the sum of the two functions is recommended. The discussion also highlights that changing from cosine to sine functions does not fundamentally alter the fitting process, as they are mathematically interchangeable. Understanding the relationship between the functions and the data is crucial for effective curve fitting.
SataSata
Messages
39
Reaction score
2
I plotted a graph on Origin software and need to do curve fitting to get accurate results. From my understanding, I need to provide a function for the fitting. So how do I derive the function?

I am actually provided with the function I(x)=I0-I1cos(x-x0) and this function will fit the lowest part of my curve and the program will derive x0 which is the value of x when the y value is the lowest. On the other hand, the function I(x)=I2+I3cos(x-x1) will fit the highest part of the curve and x1 is the value of x when y is the highest.

Can somebody explain those 2 functions and how the software fit the curve with it and how all this can be related to the Taylor's Series?
 
Physics news on Phys.org
I cannot help at all with Origin software, but I can help you with the curve fitting in general.

If you can, a priori, separate your data into "high part" data and "low part" data then you could fit the "high part" data to one function and the "low part" to the other function. My guess is that you cannot do that a priori (i.e. without looking at the y values). Therefore you should simultaneously fit all of the data to a single function which would fit both the high part and the low part. The easiest such function would simply be the sum of the two functions.

The other thing that you would like to avoid is any non-linear fitting. Unfortunately, the way that you have it written is non-linear in both x0 and x1.

So, can you think of a simple function which is equal to the sum of the two functions you have given, and pulls all of the fit parameters outside of the sin and cos functions?
 
  • Like
Likes SataSata
Thank you DaleSpam. I don't understand why we need to avoid non-linear fitting but my curve is suppose to look like a period of cos curve. I guess this is a mathematical question but what does those two functions actually mean? Would the result be different if they are change to sin? Why is it minus for the lowest part and plus for the highest part?
 
SataSata said:
I don't understand why we need to avoid non-linear fitting but my curve is suppose to look like a period of cos curve.
There are non-linear fitting routines, but they usually require an initial guess, and they can converge to bad fits sometimes or be very sensitive to the guess or noise in the data. It is not that you cannot do non-linear fitting, but you usually get better results if you can linearize your system (which you can here).
SataSata said:
I guess this is a mathematical question but what does those two functions actually mean?
I don't know the context, you haven't said. It means that I(x) has a given relationship to x, but I cannot tell you more.

SataSata said:
Would the result be different if they are change to sin?
This is along the lines that you should be thinking about. Since ##\cos(x) = \sin(x+\pi/2)## then if you fit a function to ##\cos(x-x_0)## that is exactly the same as fitting a function to ##\sin(x-k_0)## where ##k_0=x_0+\pi/2##.

SataSata said:
Why is it minus for the lowest part and plus for the highest part?
This is the same as with the previous question. There is no difference between fitting ##I_1 \cos(x)## vs ##-I_3 \cos(x)##. They will both fit the same data equally well simply with the fit parameters ##I_1=-I_3##.
 
  • Like
Likes SataSata

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 6 ·
Replies
6
Views
5K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 12 ·
Replies
12
Views
7K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 0 ·
Replies
0
Views
1K
  • · Replies 9 ·
Replies
9
Views
5K
  • · Replies 5 ·
Replies
5
Views
3K