MATLAB Division of Matrices in MatLab: Explained

  • Thread starter Thread starter magda3227
  • Start date Start date
  • Tags Tags
    Division Matrix
AI Thread Summary
Matrix division in MATLAB is not performed in the traditional sense of dividing one matrix by another. Instead, when executing an operation like A/B, MATLAB computes the solution to the equation AX = B using least squares methods, particularly when dealing with non-square matrices. This is equivalent to multiplying A by the pseudo-inverse of B, which can be derived using techniques like QR decomposition. The confusion arises because B must be a compatible matrix or vector for the operation to yield a valid result. The operation A/B effectively finds a solution that minimizes the error in the system of equations, rather than calculating a direct inverse. Understanding this method requires familiarity with concepts such as the Moore-Penrose pseudo-inverse, which provides a way to handle non-square matrices in such calculations.
magda3227
Messages
19
Reaction score
0
As far as I know, matrices cannot be divided, you have to multiply one matrix by the inverse of the other...I believe.

However, I am converting MatLab code into ANSI C and MatLab apparently divides two matrices. An example is the following...

>>A=[1.5708 1.5708];
B=[0.4937 0.7652];
A/B

ans =

2.3846


I have no idea how MatLab generated this answer. I try to find the inverse of the second matrix, but since it is a non-square matrix, MatLab denies my request. Can anyone aid me in figuring out how such an answer was calculated? Thank you in advance.
 
Physics news on Phys.org
I looked through that as well, but it says that it is equal to A*inverse(B)...but like I said, I cannot calculate the inverse of B. MatLab itself won't do it for me if I write the command line, so I don't see how it completes the matrix division calculation without finding the inverse of B.

It also says that it is equivalent to A/B = (B'\A')'. But again, You have to divide two matrices, only here, it is the conjugate transposes of the two. So even if I find the conj. transposes of the two (which will basically move the rows into columns), I still cannot find out how they got 2.3846 as an answer.
 
Presumably you need to decipher:
If A is an m-by-n matrix with m ~= n and B is a column vector with m components, or a matrix with several such columns, then X = A\B is the solution in the least squares sense to the under- or overdetermined system of equations AX = B. The effective rank, k, of A is determined from the QR decomposition with pivoting (see Algorithm for details). A solution X is computed that has at most k nonzero components per column.

It's too late here for me to get my head around that, but someone else will probably come along who can.
 
maze said:

THANKS!

I had a look at this before, but I didn't really understand it, so I looked for simpler explanations. It took my stupid self about 30 minutes to fully comprehend what it was saying. I really had to read slowly. lol. It is very brief, but rightfully so. Not much more explaining needed once you get it. Thanks a bunch.
 
Back
Top