MATLAB: Ax=b solution with singular matrix.

fsolve

%x+2y+3z=14
%4x+5y+6z=32
%7x+8y+9z=41
(actually, x=1,y=2,z=3)
A=[1 2 3;4 5 6;7 8 9]
b=[14;32;41]
x=A\b
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.093272e-16.
%in order to eliminate this singularity singular value decomposition strongly recommended.
How can I perform svd for solving this equation properly?

Best Answer

pinv(A)*b