What is the result of the operation A\B, where A(1, m) and 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? However, the matrix A'*A is singular...
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:
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 returns a least-squares solution to the system of equations A*x= B.
Description. example. C = A . * B multiplies arrays A and B by multiplying corresponding elements. The sizes of A and B must be the same or be compatible.
' is the transpose, and the A' is complex conjugate transpose. It only makes a difference if you have complex numbers in the matrix. http://www.mathworks.com/help/matlab/ref/transpose.html.
* is matrix multiplication while . * is elementwise multiplication. In order to use the first operator, the operands should obey matrix multiplication rules in terms of size. Show activity on this post.
My MATLAB (R2010b) says quite a lot about what A\B does:
mldivide(A,B)and the equivalentA\Bperform matrix left division (back slash).AandBmust be matrices that have the same number of rows, unlessAis a scalar, in which caseA\Bperforms element-wise division — that is,A\B = A.\B.If
Ais a square matrix,A\Bis roughly the same asinv(A)*B, except it is computed in a different way. IfAis ann-by-nmatrix andBis a column vector withnelements, or a matrix with several such columns, thenX = A\Bis the solution to the equationAX = B. A warning message is displayed ifAis badly scaled or nearly singular.If
Ais anm-by-nmatrix withm ~= nandBis a column vector withmcomponents, or a matrix with several such columns, thenX = A\Bis the solution in the least squares sense to the under- or overdetermined system of equationsAX = B. In other words,Xminimizesnorm(A*X - B), the length of the vectorAX - B. The rankkofAis determined from the QR decomposition with column pivoting. The computed solutionXhas at mostknonzero 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/Aperform matrix right division (forward slash).BandAmust have the same number of columns.If
Ais a square matrix,B/Ais roughly the same asB*inv(A). IfAis ann-by-nmatrix andBis a row vector withnelements, or a matrix with several such rows, thenX = B/Ais the solution to the equationXA = Bcomputed by Gaussian elimination with partial pivoting. A warning message is displayed ifAis badly scaled or nearly singular.If
Bis anm-by-nmatrix withm ~= nandAis a column vector withmcomponents, or a matrix with several such columns, thenX = B/Ais the solution in the least squares sense to the under- or overdetermined system of equationsXA = B.
x = inv (A'*A)*A'*B goes for over determined systems (i.e. which feature A as an n x m matrix with n>m; in these circumstances A'A is invertible).
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 w.r.t. the usual least squares, that is
X = argmin_{X \in S} ||X||,
where S is the set of solutions. In other words, it gives you the solution of the system having minimum L^2 norm. (Consider that you can handle the problem by hands, at least in your case).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With