How do I fit errorbars with standard deviation on a fitted curve using cftool?

37 vues (au cours des 30 derniers jours)
Julia
Julia le 7 Juil 2014
Modifié(e) : Julia le 23 Juil 2014
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

Réponse acceptée

Mads
Mads le 7 Juil 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

Plus de réponses (1)

Julia
Julia le 23 Juil 2014
Modifié(e) : Julia le 23 Juil 2014
Hey Mads,
thanks a million for your help. I didn't even know that I could generate the M-code like that. I had to add hold on and hold off around the errorbar command and now it works. Can't use the RMSE so, but I just calculate the standard deviation myself.
Julia

Catégories

En savoir plus sur Curve Fitting Toolbox dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by