关于matlab中矩阵运算A/B的疑问

来源:百度知道 编辑:UC知道 时间:2024/06/07 08:49:34
A/B按我的解释应该是A乘以B的逆矩阵,这样的话B必须是一个方阵才可逆呀!
可是我运行时出现:
>> a=[1;2;3;4;5;6];
>> b=a;
>> a/b

ans =

0 0 0 0 0 0.1667
0 0 0 0 0 0.3333
0 0 0 0 0 0.5000
0 0 0 0 0 0.6667
0 0 0 0 0 0.8333
0 0 0 0 0 1.0000
运算的结果是6维的矩阵,这并不是什么点除呀!!再者:
>> a=[1;2;3;4;5;6];
>> b=[4;2;6;4;5;6];
>> a/b

ans =

0 0 0.1667 0 0 0
0 0 0.3333 0 0 0
0 0 0.5000 0 0 0
0 0 0.6667 0 0 0
0 0 0.8333 0 0

matlab里的'/'不完全等于矩阵除法。
你可以用help mrdivide看一下'/'的帮助:
>> help mrdivide

/ Slash or right matrix divide.
A/B is the matrix division of B into A, which is roughly the
same as A*INV(B) , except it is computed in a different way.
More precisely, A/B = (B'\A')'. See MLDIVIDE for details.

就是说A/B可以大致看成A*inv(B),但用的是另一种方法。更确切的讲A/B = (B'\A')'。

那再看看'\'(左除或者反除)是什么东东。
>> help mldivide

\ Backslash or left matrix divide.
A\B is the matrix division of A into B, which is roughly the
same as INV(A)*B , except it is computed in a different way.
If A is an N-by-N matrix and B is a column vector with N
components, or a matrix with several such columns, then
X = A\B is the solution to the equation A*X = B computed by
Gaussian elimination. A warning message is printed if A is