How to compute inverse of a matrix accurately?
我正在尝试计算矩阵
在这种情况下我该怎么办?
仅当您明确需要矩阵的逆时,才使用
x = A\\b is computed differently thanx = inv(A)*b and is recommended for solving systems of linear equations.
这是因为反斜杠运算符或
x = A\\B solves the system of linear equationsA*x = B . The matricesA andB must have the same number of rows. MATLAB? displays a warning message ifA is badly scaled or nearly singular, but performs the calculation regardless.
如此您就知道MATLAB根据您的输入矩阵选择哪种算法,这是其文档中提供的完整算法流程图
The versatility of
mldivide in solving linear systems stems from its ability to take advantage of symmetries in the problem by dispatching to an appropriate solver. This approach aims to minimize computation time. The first distinction the function makes is between full (also called"dense") and sparse input arrays.
作为有关数量级误差
您拥有所谓的病态矩阵。尝试对这种矩阵求逆是冒险的。通常,取除最小矩阵(例如线性代数课本简介中看到的矩阵)之外的任何东西的逆都是有风险的。如果必须的话,可以尝试使用Moore-Penrose伪逆(请参阅Wikipedia),但是即使那样也不是万无一失的。