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

In summary, the conversation discusses the process of curve fitting using Origin software. The program requires a function to fit the data and the user is provided with two functions, each fitting a different part of the curve. The goal is to find a single function that fits both parts of the curve, and it is suggested to avoid non-linear fitting. The functions given are related to the Taylor's Series. The discussion also addresses the difference between using cosine and sine functions and why one function has a minus sign while the other has a plus sign.
  • #1
SataSata
39
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
  • #2
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
  • #3
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?
 
  • #4
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

1. What is curve fitting?

Curve fitting is a mathematical process of finding a curve or function that closely matches a set of given data points. The goal of curve fitting is to create a model that can predict the values of the data points beyond the given data set.

2. Why is curve fitting important in science?

Curve fitting is important in science because it allows us to analyze and interpret data, make predictions, and understand patterns and relationships between variables. It also helps us to identify trends and make informed decisions based on the data.

3. What are the different types of curve fitting methods?

There are several types of curve fitting methods, such as linear regression, polynomial regression, exponential regression, and logarithmic regression. Each method is suitable for different types of data and can provide varying levels of accuracy.

4. What are the limitations of curve fitting?

Curve fitting is a useful tool, but it has its limitations. One of the main limitations is that it assumes a linear or smooth relationship between the variables, which may not always be the case in real-world situations. Additionally, curve fitting cannot account for outliers or errors in the data.

5. How do you determine the best fit curve for a given data set?

The best fit curve for a given data set can be determined by evaluating the goodness of fit, which measures how well the curve fits the data points. This can be done by calculating the coefficient of determination (R-squared) or by visually inspecting the curve and data points. The curve with the highest R-squared value or the closest visual fit is considered the best fit for the data set.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
878
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
897
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
Back
Top