How to find and plot the absolut average error of a fittet curve to a Set of Data
3 views (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
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)
0 Comments
See Also
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!