Clear Filters
Clear Filters

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

1 view (last 30 days)
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?

Answers (1)

Ameer Hamza
Ameer Hamza on 28 Nov 2020
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)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!