Publisher review:Orthogonal Linear Regression fits a line y=p0 p1*y to a dataset (xdata,ydata) in an orthogonal way. Orthogonal linear least square fit of xdata and ydata vectors p=linortfit(xdata,ydata) gives the the coefficient-vector p that corresponds to the linear expression: y=p(1) p(2)*x, where p is minimized with respect to the objective functionsum((p(1) p(2)*xdata-ydata).^2/(1 p(2)^2)).Example:
prepare some dataxdata=0:0.1:10;ydata=2 7*xdata 6*randn(size(xdata));
orthogonal linear fitp=linortfit(xdata,ydata)yy=p(1) p(2)*xdata;
compare with normal linear regressionp0=polyfit(xdata,ydata,1);yy0=polyval(p0,xdata);
plot to compare data with linear fitsplot(xdata,ydata,'.',xdata,yy,xdata,yy0,':'); Requirements: ยท MATLAB Release: R13SP1
Orthogonal Linear Regression is a Matlab script for Mathematics scripts design by Per Sundqvist.
It runs on following operating system: Windows / Linux / Mac OS / BSD / Solaris.
Operating system:Windows / Linux / Mac OS / BSD / Solaris