MATLAB: Lscov (weighted least squares) not deweighing when weights are altered

least squareslscovminimization

I am currently trying to use weighted least squares via lscov, to minimize using the design matix,
A = [-0.7867 0.0464 -0.6155 1.0000;
-0.3751 0.4299 -0.8213 1.0000;
0.0447 0.4895 -0.8708 1.0000;
-0.5946 0.8029 0.0424 1.0000]
and the error vector
b = [26.3019 0 4.4677 4.6455]'
However, using lscov, the results are the same.
x1 = lscov(A,(b),[.001 1 1 1])
x2 = lscov(A,(b),[1 1 1 1])
x1 = x2 = [26.2071 -73.2683 43.6825 77.2045]'
I have realized that this is because A is a square matrix. Is there a way to minimize with a weighting on a residual vector in the case of square matrices.
I have considered multiplying the error vector by a weight but I am not sure that is a reasonable approach.

Best Answer

Is there a way to minimize with a weighting on a residual vector in the case of square matrices.
You already are doing so. It's just that, if A is non-singular, the weighting will not matter because the solution A\b always achieves ideal zero residuals regardless of the weights. If A is singular, then weighting will have an impact, but the solution will be under-determined.