Different results for same equation in curve fitting
11 views (last 30 days)
Show older comments
Why is custom fitting not the same as the exponential default one as shown in the picture? The data fits nicely when I use the 'exp2' instead.
I'm relatively new to MATLAB and this is quite baffling to me as i am unable to use a custom equation as it simply does not fit.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/685188/image.png)
4 Comments
Tzu-Yi Chang
on 7 Feb 2024
Hi,
Although this conversation was years ago, but I'd like to ask the same question again.
I have the same issue, and even I maunally select the same start point in my customize equation, the results still different between prepackaged 2nd exponential and customize 2nd exponential. Is there any other trick?
Thanks!
Answers (1)
KALASH
on 9 Jun 2024
Hi Ayushi,
I reproduced the graph using the dataset you had provided for both the custom equation option and the exponential option in the "Curve Fitter Tool" using the equation: a*exp(b*x) + c*exp(d*x).
I kept all the parameters and options in the tool same including the starting point, the fitting algorithm etc got the same graph in both the cases as shown below, also have a look at the results which are similar or have very slight differences which is normal.
Graph for the inbuilt exponential option:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1712341/image.png)
Graph for the custom option:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1712346/image.png)
As you can see there is a difference between the coefficients in the results of both the equations and possible explanation for that is there can be a difference in the internal implementation and the data preprocessing which can depend on the chosen model type. This could include data sampling, scaling of variables, handling of outliers, or even slight differences in how the data points are weighted in the fitting process.
Regarding the equation which you mentioned in the comments later, you can simply use the custom equation option and find out the value. Feel free to play around with the fit options and choose the one which best fits your requirements. Below is the graph of what I tried with the equation: a*exp(-x/T) + c*(T*exp(-x/T)) - c*T + c*x
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1712351/image.png)
For more information on the "Curve Fitter Tool", have a look at the documentation here:
Hope this helps!
0 Comments
See Also
Categories
Find more on Fit Postprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!