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

9 ビュー (過去 30 日間)
Julia
Julia 2014 年 7 月 7 日
編集済み: Julia 2014 年 7 月 23 日
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

採用された回答

Mads
Mads 2014 年 7 月 7 日
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

その他の回答 (1 件)

Julia
Julia 2014 年 7 月 23 日
編集済み: Julia 2014 年 7 月 23 日
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

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by