X=A\B would give least square solution for an overdetermined linear system,e.g I have three variables (x,y,z) with 20 equation so A is a rectangular 20×3 matrix and B is 20×1 constant column matrix. But I have a constraint where the all elements of B[i]( [B]>0). But when solving by least square using A\B solutions are X={a,b,c} such that when I again calculate A*X (=Bcal, calculated value of RHS) to check with actual B(experimental), few Bcal elements are negative. So I need a solution in MATLAB Is it possible to put a constraint such that the X are optimized in such a way in the Least Square so that all the elements Bcal(=A*X)>0 or say any other constraint {where the solution elements of X are to be optimized along with least error/residuals} as per constraint..
MATLAB: Help me in solving Overdetermined Linear LeastSquares solution of AX=B with constraint that every element of column matrix B >0 (B[i]>0)
least square solutionlinear algebramathematicsnumerical solutionoverdetermined system
Best Answer