How do I fit errorbars with standard deviation on a fitted curve using cftool?
10 views (last 30 days)
Show older comments
Hey,
I am using cftool to fit special exponential curves with custom equation. I'd like to have errorbars (with standard deviation) in this graphic (fitted curve) for the individual measured points. Is is possible to do that using cftool? If not, could you please tell me how to do the fitting and the errorbars without cftool. I really need step by step explanations, because I am an absolutely newcomer in Matlab.
Thanks in advance.
Julia
0 Comments
Accepted Answer
Mads
on 7 Jul 2014
Hey J
Here is one suggestion:
1) use cftool as you do to make a fit on your data. Once you are are done, in the cftool window you go to "File", and click "Generate Code"
That should give you a m-file that basically, when run, gives you the same result as when you manually used cftool.
2) Now you use the output from the fit-function which you see in this m-file.
The second output from fit, say it is called gof, is a goodness-of-fit-struct which contains fx. rmse (standard error)
so I think you look for:
gof.rmse
3) Play with the plotting-function errorbar(...)
Takes:
figure errorbar(X,Y,E)
where E is the errorbar value on Y for a given X
so E associates with gof.rmse if I understand correctly if X and Y are the fit data, not the real data.
Hope this helps.
I found it useful to read about "fit" in the documentation.
Best
Mads
0 Comments
More Answers (1)
See Also
Categories
Find more on Histograms in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!