Error estimate in Polyfit
4 views (last 30 days)
Show older comments
Hello,
I'm now reading Moler's Numerical Computing with MATLAB. In M file Cencusgui , in section for error estimate, following lines are written.
Why the error is estimated in this way, would you please provide some theoretical explanation ?
% Provide error estimates for censusgui
switch model
case 'polynomial'
if d > 0
V(:,d+1) = ones(size(t));
s = (t-1955)/55;
for j = d:-1:1
V(:,j) = s.*V(:,j+1);
end
[~,R] = qr(V);
R = R(1:d+1,:);
RI = inv(R);
E = zeros(length(x),d+1);
s = (x-1955)/55;
for j = 1:d+1
E(:,j) = polyval(RI(:,j),s);
end
sig = 10; % Rough estimate
e = sig*sqrt(1+diag(E*E'));
errest = [y-e; NaN; y+e];
else
errest = [y-NaN; NaN; y+NaN];
end
0 Comments
Answers (0)
See Also
Categories
Find more on Spline Postprocessing 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!