A\B运算的结果是什么,其中A(1, m)和B(1, m)?
说明书上写着:
A\B returns a least-squares solution to the system of equations A*x= B.
所以这意味着 x = inv (A'*A)*A'*B?但是,矩阵 A'*A 是奇异的...
让我们假设:
A=[1 2 3]
B=[6 7 6]
A\B
0 0 0
0 0 0
2.0000 2.3333 2.0000
如果使用 MLS:
C = inv (A'*A) singular matrix
C = pinv(A'*A)
0.0051 0.0102 0.0153
0.0102 0.0204 0.0306
0.0153 0.0306 0.0459
D= C*A'*B
0.4286 0.5000 0.4286
0.8571 1.0000 0.8571
1.2857 1.5000 1.2857
所以结果 A\B 和 inv (A'*A)*A'*B 是不同的...
最佳答案
我的 MATLAB (R2010b) 说了很多关于 A\B
的内容做:
mldivide(A,B)
and the equivalentA\B
perform matrix left division (back slash).A
andB
must be matrices that have the same number of rows, unlessA
is a scalar, in which caseA\B
performs element-wise division — that is,A\B = A.\B
.If
A
is a square matrix,A\B
is roughly the same asinv(A)*B
, except it is computed in a different way. IfA
is ann
-by-n
matrix andB
is a column vector withn
elements, or a matrix with several such columns, thenX = A\B
is the solution to the equationAX = B
. A warning message is displayed ifA
is badly scaled or nearly singular.If
A
is anm
-by-n
matrix withm ~= n
andB
is a column vector withm
components, or a matrix with several such columns, thenX = A\B
is the solution in the least squares sense to the under- or overdetermined system of equationsAX = B
. In other words,X
minimizesnorm(A*X - B)
, the length of the vectorAX - B
. The rankk
ofA
is determined from the QR decomposition with column pivoting. The computed solutionX
has at mostk
nonzero elements per column. Ifk < n
, this is usually not the same solution asx = pinv(A)*B
, which returns a least squares solution.
mrdivide(B,A)
and the equivalentB/A
perform matrix right division (forward slash).B
andA
must have the same number of columns.If
A
is a square matrix,B/A
is roughly the same asB*inv(A)
. IfA
is ann
-by-n
matrix andB
is a row vector withn
elements, or a matrix with several such rows, thenX = B/A
is the solution to the equationXA = B
computed by Gaussian elimination with partial pivoting. A warning message is displayed ifA
is badly scaled or nearly singular.If
B
is anm
-by-n
matrix withm ~= n
andA
is a column vector withm
components, or a matrix with several such columns, thenX = B/A
is the solution in the least squares sense to the under- or overdetermined system of equationsXA = B
.
关于Matlab,运算符 A\B,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13380420/