Welcome to the world of numerical methods, let me be your guide.
You, as a new person in this world wonders, "Why would I do something this difficult with this SVD stuff instead of the so commonly known inverse?! Im going to try it in Matlab!"
And no answer was found. That is, because you are not looking at the problem itself! The problems arise when you have an ill-conditioned matrix. Then the computing of the inverse is not possible numerically.
example:
A=[1 1 -1;
1 -2 3;
2 -1 2];
try to invert this matrix using inv(A)
. Youll get infinite.
That is, because the condition number of the matrix is very high (cond(A)
).
However, if you try to solve it using SVD method (b=[1;-2;3]
) you will get a result. This is still a hot research topic. Solving Ax=b systems with ill condition numbers.
As @Stewie Griffin suggested, the best way to go is mldivide
, as it does a couple of things behind it.
(yeah, my example is not very good because the only solution of X is INF, but there is a way better example in this youtube video)