Matrix multiplication from the right with inverse matrix
112 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
a=[-0.7398 1.638; 1.4522 -4.258; 2.192 5.42];
r=[2.74 1.6; 0 6.9; 0 0];
u=a\r;
u
I know it's a trivia question but I'm just a begginer and it's really bugging me out.
I have this equation: U=R*A^-1 . From the documentation I found out that u=a/r calculates U=A^-1*R. I've been spilling my brains out trying to find a way to get this equation right but some of the possible answers I found only made me more confused.
Can someone please show me a possible way to implement this equation U=R*A^-1 in matlab and to work properly?
0 comentarios
Respuestas (2)
Ameer Hamza
el 18 de Nov. de 2020
Editada: Ameer Hamza
el 18 de Nov. de 2020
You can use mrdivide /
u = r/a
The equation is equivalent to . mrdivide is used for such equations.
2 comentarios
John D'Errico
el 18 de Nov. de 2020
No. If you delete the zero column and the zero row, then you CANNOT form the product of a 2x2 matrix times a 3x2 matrix in that order. This is basic linear algebra, how you multiply matrices.
John D'Errico
el 18 de Nov. de 2020
Editada: John D'Errico
el 18 de Nov. de 2020
a is a 3x2 matrix. No matter what, you cannot compute the inverse of a, so
U=R*A^-1
is meaningless.
I assume you want to solve for the matrix U, such that
U*a == r
as closely as possible. That is, norm(U*a-r) is the smallest possible value over all matrices U?
a=[-0.7398 1.638; 1.4522 -4.258; 2.192 5.42];
r=[2.74 1.6; 0 6.9; 0 0];
In the help for / (known as mrdivide if you look at the function itself) we see:
>> help /
/ 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.
So, if you could invert the matrix you call a, we would perform your task as:
U = r/a;
Does u have the desired property? Yes.
norm(U*a- r)
As we see, the norm is effectively zero, or as close as we could come in floating point arithmetic.
r
U*a
The matrix U is a 3x3 matrix. as in order for the sizes of the matrices to conform for matrix multiplication, it must have that size.
U
As you can see, U is 3x3. Remember how you multiply matrices. If you wish to form the product U*a, where a is 3x2, and have the result be a matrix of size 3x2 also, then U MUST be a 3x3 matrix.
0 comentarios
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!