Error estimate in Polyfit

4 views (last 30 days)
hu renlin
hu renlin on 15 Mar 2019
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

Answers (0)

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!