Graphics Programs Reference
In-Depth Information
A=zeros(m);b=zeros(m,1);s=zeros(2*m-1,1);
fori=1:length(xData)
temp = yData(i);
forj=1:m
b(j) = b(j) + temp;
temp = temp*xData(i);
end
temp = 1;
forj=1:2*m-1
s(j) = s(j) + temp;
temp = temp*xData(i);
end
end
fori=1:m
forj=1:m
A(i,j) = s(i+j-1);
end
end
% Rearrange coefficients so that coefficient
% of xˆ(m-1) is first
coeff = flipdim(gaussPiv(A,b),1);
stdDev
After the coefficients of the fitting polynomialhave been obtained, the standard de-
viation
can becomputedwith the function stdDev . The polynomialevaluationin
stdDev iscarried out by the subfunction polyEval which is describedinArt. 4.7—see
Eq. (4.10).
σ
function sigma = stdDev(coeff,xData,yData)
% Returns the standard deviation between data
% points and the polynomial
% a(1)*xˆ(m-1) + a(2)*xˆ(m-2) + ... + a(m)
% USAGE: sigma = stdDev(coeff,xData,yData)
% coeff = coefficients of the polynomial.
% xData = x-coordinates of data points.
% yData = y-coordinates of data points.
m=length(coeff);n=length(xData);
Search WWH ::




Custom Search