Plot - show fitting error

8 ビュー (過去 30 日間)
Auryn_
Auryn_ 2019 年 3 月 5 日
回答済み: darova 2019 年 3 月 5 日
Hi,
Starting with a set of data points, I use a fitfun function to fit it to a nonlinear scaling function A^x.
Now, I would like to quantify the error of the fits themselves, to understand how the points deviate from the scaling function.
May I ask for any help to do this?
Thanks!

回答 (1 件)

darova
darova 2019 年 3 月 5 日
A = 1.9;
x = linspace(0,4,50);
y = A.^x + rand(1,50);
res = fit(x',y','A.^x');
y1 = res.A.^x;
plot(x,y,'.',x,y1)
legend('data','fit')
figure
title('Error')
plot(x,y1-y)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by