# Different results for same equation in curve fitting

9 views (last 30 days)
Ayushi Sharma on 15 Jul 2021
Answered: KALASH on 9 Jun 2024
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.
Ayushi Sharma on 15 Jul 2021
I already have a custom equation:
a*exp(-x/T) +c*(T*(exp(-x/T)-1)+x)
I need to find the value of constant 'c'
In the csv attached:
y = dv
and x= t
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!

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:
Graph for the custom option:
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
For more information on the "Curve Fitter Tool", have a look at the documentation here:
Hope this helps!