1x4 times 4x4 matrix in Matlab
71 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi!
I have a 4x4 matrix (say P) and I need to multiply it with a 1x4 (say A) matrix. I saw the answers that I needed to do P*A' to get the right answer. But when I do that it is not the right solution, so did I maybe fill in wrong numbers in the matrix is that my mistake or is there another way to solve this multiplication?
3 Commenti
Stephen23
il 11 Dic 2020
Modificato: Stephen23
il 11 Dic 2020
"I have a 4x4 matrix (say P) and I need to multiply it with a 1x4 (say A) matrix."
According to the rules of matrix multiplication
the two adjacent dimensions must be the same. This means it is not possible to multiply a 4x4 matrix with a 1x4 matrix, but it is possible to multiply 4x4 by 4x1 to get a 4x1 matrix or 1x4 by 4x4 to get a 1x4 matrix. Which of these, if any, are correct for your situation depends on you knowing what operation you need to perform. It is also possible the matrix multiplication is entirely the wrong operation (perhaps you should be doing element-wise array multiplication?).
"But when I do that it is not the right solution, so did I maybe fill in wrong numbers in the matrix is that my mistake or is there another way to solve this multiplication?"
It is not clear what you mean by "solve this multiplication": from what you have told us so far we have no idea what exact values you tried, what exactly you expect the output to be, and how you checked the output, or even if this operation is suitable at all. Perhaps you are getting some floating point issues... we don't know, because you didn't show what you are doing nor what you expect.
Matrix multiplication does not need to be "solved", it already works according to the standard accepted definition.
Risposte (1)
Daniel Pollard
il 11 Dic 2020
Use the rules for matrix multiplication to help you. What solved one persons problem won't always solve yours.
A 4x4 multiplied by a 4x1 should work. A 4x4 multiplied by a 1x4 won't. In your case, P*A will return an error, but P*A' shouldn't.
If you copy and paste your code and any error messages, it makes it much easier to provide a comprehensive answer.
0 Commenti
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!