image thumbnail

Weighted Orthogonal Least Squares

version (24.3 KB) by Andrey Sokolov
Fits line ax+by+c=0 to supplied points and their weights


Updated 21 Mar 2011

View License

The function computes parameters a, b, and c of the weighted orthogonal least squares fit of line ax+by+c=0 to a set of 2D points with coordinates given by x and y and weights w.

y=2.5*x + (5+300./x).*randn(1,n);
hold on
[a b c] = wols(x,y,w);
plot([0,n],[-c/b,-c/b - a/b*n],'-r','LineWidth',2)

Cite As

Andrey Sokolov (2022). Weighted Orthogonal Least Squares (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!