MATLAB: Invert Matrix Command

invert matrix

A and B are matrices, which A is invers from B. Is there any differences between A=B^-1; A=B.\1; A=inv(B);
coz i have different result from 3 command above

Best Answer

Statement A=B.\1 doesn't calculate an inverse matrix. You probably mean:
A2=B\eye(size(B))
B^-1 and inv(B) give the same result. B\eye(size(B)) is a little different, because it uses different algorithm.