how to plot residual and fitting curve
Show older comments
Hi I have two set of data (a,b).
a=[6.91 8.26 2.21 1.19 2.32 8.41 7.3 4.32 2 3.42 3.21 7.54 8.72 2.38 3.1 8.18 5.47 1.27 6.09 7.98 7.69 5.39 7.35 7.33 5.3];
b=[17.52 1.77 14.97 7.5 15.09 9.4 17.36 22.69 12.87 19.16 19.06 14.75 9.83 17.61 18.63 11.15 23.89 10.75 22.33 14.29 16.77 22.41 16.63 17.42 21.37];
and I plot the linear regression line for it. how can I plot residual and the least square quadratic regression line ? thanks
figure(1)
scatter(a,b)
hl = lsline;
B = [ones(size(hl.XData(:))), hl.XData(:)]\hl.YData(:);
Slope = B(2)
Intercept = B(1)
Accepted Answer
More Answers (0)
Categories
Find more on Get Started with Curve Fitting Toolbox 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!