How to find and plot the absolut average error of a fittet curve to a Set of Data

2 次查看(过去 30 天)
In a for Loop I have my Data:
x_relevant{i} = x{i}(idx_min{i}:idx_max{i})
y_relevant{i} = y{i}(idx_min{i}:idx_max{i})
plot(x_relevant{i},y_relevant{i},'color',c2{i},'Marker','.','linestyle','none')
hold on
And a fittet linear Regression:
p{i} = polyfit(x_relevant{i}, y_relevant{i},1)
fit = polyval(p{i},x_relevant{i})
plot(x_relevant{i},fit,'color',c{i},'LineWidth',2)
hold on
How do I find the Standard error of this fitted curve?

回答(1 个)

Ameer Hamza
Ameer Hamza 2020-11-28
You can add the absolute error between actual datapoints and fitted curve like this
p{i} = polyfit(x_relevant{i}, y_relevant{i},1)
fit = polyval(p{i},x_relevant{i})
plot(x_relevant{i},fit,'color',c{i},'LineWidth',2)
hold on
plot(x_relevant{i},abs(fit-y_relevant{i}),'color',c{i},'LineWidth',2)

类别

Help CenterFile Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by