使用SVD解决Ax = b有什么好处 [英] What is benefit to use SVD for solving Ax=b
问题描述
我有一个线性方程,例如
I have a linear equation such as
Ax=b
其中 A
是满秩矩阵,其大小 512x512
。 b
是 512x1
的向量。 x
是未知的向量。我想找到 x
,因此,我有一些选择这样做
where A
is full rank matrix which its size is 512x512
. b
is a vector of 512x1
. x
is unknown vector. I want to find x
, hence, I have some options for doing that
1.使用正常方式
inv(A)*b
2.使用SVD(奇异值分解)
2.Using SVD ( Singular value decomposition)
[U S V]=svd(A);
x = V*(diag(diag(S).^-1)*(U.'*b))
两种方法都给出相同的结果。那么,使用SVD解决 Ax = b
的好处是什么,特别是在 A
的情况下是2D矩阵?
Both methods give the same result. So, what is benefit of using SVD to solve Ax=b
, especially in the case A
is a 2D matrix?
推荐答案
欢迎来到数值方法的世界,让我成为你的向导。
Welcome to the world of numerical methods, let me be your guide.
你,作为这个世界上的新人想知道,为什么我会用这个SVD的东西做这个困难而不是那么常见的逆转?!我将在Matlab中尝试它!
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.
例如:
A=[1 1 -1;
1 -2 3;
2 -1 2];
尝试使用 inv(A)$ c $反转此矩阵C>。你会变得无限。
也就是说,因为矩阵的条件数非常高( cond( A)
)。
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)
).
但是,如果你尝试使用SVD方法解决它( b = [1; - 2; 3]
)你会得到一个结果。这仍然是一个热门的研究课题。解决具有病态数字的Ax = b系统。
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.
正如@Stewie Griffin建议的那样,最好的方法是 mldivide
,因为它背后有其中的一些内容。
As @Stewie Griffin suggested, the best way to go is mldivide
, as it does a couple of things behind it.
(是的,我的例子不是很好,因为X的唯一解决方案是INF,但有一种更好的例子在此YouTube视频中)
(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)
这篇关于使用SVD解决Ax = b有什么好处的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!