I have implemented a code for the slope,
x_ceng = sum(xi)/n; % center of gravity of x
m = sum(xi-x_ceng)*yi/sum(xi-x_ceng)^2; % Slope
di = yi-m*xi-c; % the residuals
D = sum(xi-x_ceng)^2;
% The standard error is then given by;
dm = sqrt(sum(di^2)/D*(n-2))
I have compared m with values of polyfit and it agrees, but I am not certain that the standard error is correct. I am obtaining very low dm that what I would like considering the spread of the data that I obtain.
Is there any function in MATLAB that I can compare dm with?
Many Thanks for any input.
Play games and win prizes!Learn more