curve fitting with error bar

69 ビュー (過去 30 日間)
Babu Sankhi
Babu Sankhi 2021 年 5 月 26 日
回答済み: Srivardhan Gadila 2021 年 6 月 7 日
Hi,
I want to fit the curve with the error bar but it didn't display the error bar. Can you please help me how can I fit the data (curve) with error bar? I tried the following codes..
curvefit = fit(x2,y2,'poly3','normalize','on');
figure (13);
errorbar(x2,y2,err2,'go');hold on;% plots the graph with errorbar
plot(curvefit,x2,y2);hold off

回答 (1 件)

Srivardhan Gadila
Srivardhan Gadila 2021 年 6 月 7 日
Based on the above information I think while calling the errorbar function you have to first compute the value of y coordinates from the fitted curve and then call the errorbar funtion on these new values in order to get the errorbar on the curve.
load franke
cfit = fit(x,y,'poly3','normalize','on');
figure
plot(cfit,x,y)
hold on
yfit = cfit(x);
err = abs(y-yfit);
errorbar(x,yfit,err,'go')
If this is not what you are looking for, can you provide more information by attaching images of what should be the output plot and any other required information.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by