首先用sym函数定义符号矩阵,利用inv对符号矩阵求逆后使用simplify代数化简后得到解析结果。
详情见 MATLAB帮助中心。
举例:求矩阵
(
−
1
2
−
1
2
0
−
1
6
−
1
6
2
3
1
3
1
3
1
3
)
\begin{pmatrix} \frac{-1}{\sqrt{2}} & \frac{-1}{\sqrt{2}} & 0 \\ \frac{-1}{\sqrt{6}} & \frac{-1}{\sqrt{6}} & \frac{\sqrt{2}}{\sqrt{3}}\\ \frac{1}{\sqrt{3}} & \frac{1}{\sqrt{3}} & \frac{1}{\sqrt{3}} \end{pmatrix}
⎝⎜⎛2−16−1312−16−13103231⎠⎟⎞
的逆矩阵
MATLAB R2021b
A = sym([-1/sqrt(2) 1/sqrt(2) 0
-1/sqrt(6) -1/sqrt(6) sqrt(2)/sqrt(3)
1/sqrt(3) 1/sqrt(3) 1/sqrt(3)]);
A_I = simplify(inv(A));
可得