inv是矩阵求逆的意思。具体用法A=inv(B),其中B是输入的可逆矩阵,输出A就是B的逆矩阵,逆矩阵满足性质 AB=BA=E (E是单位阵)。如果输入的是不可逆矩阵会弹出警告,并返回inf。
调用举例:
>> inv([1 0;0 0])
警告: 矩阵为奇异工作精度。
ans =
Inf Inf
Inf Inf
>> inv(rand(2))
ans =
-13.0929 5.2640
12.0501 -3.3159
另附官方英文解释(输入doc inv也可以自己查看):
Y = inv(X) returns theinverse of the square matrix X. A warning messageis printed if X is badly scaled or nearly singular.
In practice, it is seldom necessary to form the explicit inverseof a matrix. A frequent misuse of inv arises whensolving the system of linear equations Ax = b.One way to solve this is with x = inv(A)*b.A better way, from both an execution time and numerical accuracy standpoint,is to use the matrix division operator x = A\b.This produces the solution using Gaussian elimination, without formingthe inverse. See mldivide (\)for further information.
inv是矩阵求逆命令,但应该尽量少使用该命令
在求解Ax=b时,x=A\b,也可以:x=inv(A)*b
简单说:
>> s=rand(3)
s =
0.9501 0.4860 0.4565
0.2311 0.8913 0.0185
0.6068 0.7621 0.8214
>> inv(s)
ans =
1.6740 -0.1196 -0.9276
-0.4165 1.1738 0.2050
-0.8504 -1.0006 1.7125
----------------------------------
x'表示共轭转置,x.'表示非共轭转置,对于实数来说是一样的:
>> u=[1+i,3+4*i;3-i,2+2*i]
u =
1.0000 + 1.0000i 3.0000 + 4.0000i
3.0000 - 1.0000i 2.0000 + 2.0000i
>> u'
ans =
1.0000 - 1.0000i 3.0000 + 1.0000i
3.0000 - 4.0000i 2.0000 - 2.0000i
>> u.'
ans =
1.0000 + 1.0000i 3.0000 - 1.0000i
3.0000 + 4.0000i 2.0000 + 2.0000i
inv是求逆矩阵。x‘是矩阵转置(对复数矩阵而言是共轭转置)。