[英]Matlab, operator A\B
What is the result of the operation A\\B, where A(1, m) and B (1, m)? 操作A \\ B的结果是什么,其中A(1,m)和B(1,m)?
In the manual it is written: 在手册中写道:
A\B returns a least-squares solution to the system of equations A*x= B.
So it means x = inv (A'*A)*A'*B? 所以它意味着x = inv(A'* A)* A'* B? However, the matrix A'*A is singular...
但是,矩阵A'* A是单数的......
Let us suppose: 让我们假设:
A=[1 2 3]
B=[6 7 6]
A\B
0 0 0
0 0 0
2.0000 2.3333 2.0000
If ve use MLS: 如果使用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
So results A\\B and inv (A'*A)*A'*B are different... 所以结果A \\ B和inv(A'* A)* A'* B是不同的......
My MATLAB (R2010b) says quite a lot about what A\\B
does: 我的MATLAB(R2010b)说了很多关于
A\\B
作用:
mldivide(A,B)
and the equivalentA\\B
perform matrix left division (back slash).mldivide(A,B)
和等效的A\\B
执行矩阵左划分(反斜杠)。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
.A
和B
必须是具有相同行数的矩阵,除非A
是标量,在这种情况下A\\B
执行逐元素除法 - 即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.如果
A
是方阵,则A\\B
与inv(A)*B
大致相同,除非它以不同的方式计算。 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
是n
by-n
矩阵,B
是具有n
元素的列向量,或者是具有多个这样的列的矩阵,则X = A\\B
是等式AX = B
的解。 A warning message is displayed ifA
is badly scaled or nearly singular.如果
A
严重缩放或几乎是单数,则会显示警告消息。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
.如果
A
是m
by-n
矩阵,其中m ~= n
,B
是具有m
分量的列向量,或者是具有多个这样的列的矩阵,那么X = A\\B
是最小二乘意义下的解决方案。 - 或超定方程组AX = B
In other words,X
minimizesnorm(A*X - B)
, the length of the vectorAX - B
.换句话说,
X
最小化norm(A*X - B)
,即矢量AX - B
的长度。 The rankk
ofA
is determined from the QR decomposition with column pivoting.A
的等级k
由具有列旋转的QR分解确定。 The computed solutionX
has at mostk
nonzero elements per column.计算的解
X
每列最多具有k
非零元素。 Ifk < n
, this is usually not the same solution asx = pinv(A)*B
, which returns a least squares solution.如果
k < n
,这通常与x = pinv(A)*B
,它返回最小二乘解。
mrdivide(B,A)
and the equivalentB/A
perform matrix right division (forward slash).mrdivide(B,A)
和等效B/A
执行矩阵右除(正斜杠)。B
andA
must have the same number of columns.B
和A
必须具有相同的列数。If
A
is a square matrix,B/A
is roughly the same asB*inv(A)
.如果
A
是方阵,则B/A
与B*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
是n
by-n
矩阵,B
是具有n
元素的行向量,或者是具有多个这样的行的矩阵,那么X = B/A
是通过高斯消除和部分旋转计算的等式XA = B
的解。 。 A warning message is displayed ifA
is badly scaled or nearly singular.如果
A
严重缩放或几乎是单数,则会显示警告消息。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
.如果
B
是m
m ~= n
的m
by-n
矩阵,A
是具有m
分量的列向量,或者是具有多个这样的列的矩阵,则X = B/A
是最小二乘意义下的解决方案。 - 或超定方程组XA = B
x = inv (A'*A)*A'*B
goes for over determined systems (ie which feature A
as an nxm
matrix with n>m
; in these circumstances A'A
is invertible). x = inv (A'*A)*A'*B
无二超定系统(即其中设有A
作为nxm
与矩阵n>m
;在这些情况下A'A
是可逆的)。
In your case you have an under determined system. 在您的情况下,您有一个未确定的系统。
Thus, what may happen? 那么,会发生什么?
My opinion, although you can check, at least in your case : 我的意见,虽然你可以检查,至少在你的情况下 :
when you do A\\B
matlab solves an optimization problem in the inverse sense wrt the usual least squares, that is 当你做
A\\B
matlab解决了与通常的最小二乘相反的优化问题,即
X = argmin_{X \in S} ||X||,
where S
is the set of solutions. 其中
S
是一组解决方案。 In other words, it gives you the solution of the system having minimum L^2 norm. 换句话说,它为您提供了具有最小L ^ 2范数的系统的解决方案。 (Consider that you can handle the problem by hands, at least in your case).
(考虑到您可以手动处理问题,至少在您的情况下)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.