Problem with fitobject / confidence intervals
Show older comments
Hello all,
I'm fitting a curve with a custom function which is the sum of four independent funcions, let's say

Once I call the funcion fit,I can get the coefficients
by, for example,
by, for example,beta_1 = fitobject.beta1
To plot the fitting, I can simply do
plot(fitobject,vectorX,vectorY)
but in principle, I could also use the functions f1 and f2 of the first equation, and by evaluating them (as I have the coefficients) and summing them up, plot the results
plot(vectorX,f)
The problem I have is that these two options provide me with different results (at the end of the plot). I think that the correct option is the first one, since it fits my data better, but I wonder why it is not possible to use the second approach. Could it be due to the confidence intervals of the fitting coefficients? Maybe the first option employs them such that the coefficients adjust to better fit the data.
A screenshot of this region in which the two solutions diverge is the next;

For plotting the thicker red line, I'm using exactly the same expression that I have in the fitobject variable.
If you have any clue about this, I'd very grateful.
Thanks in advance
Answers (0)
Categories
Find more on Get Started with Curve Fitting Toolbox 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!