Reputation: 3
I'm trying to multiply two complex matrices (b+c*i
), but I'm getting no results.
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> impedancaZ at 14
l=mtimes(R1,h)
I don't understand this error, as matrix dimension are the same (2 coluoms and 9 rows)
Can you help me?
Upvotes: 0
Views: 452
Reputation: 13768
Inner matrix dimensions must agree
means that the inner dimensions of the matrices must match. If the first matrix has dimensions 2x9
, then the second would need to be 9
x(something). that's just basic liner algebra/matrix multiplication. In that case, you'll need to figure out what the second array should be. Maybe it's the transpose of what you expect it to be; instead of x*y
, you might want x*y'
(see the "prime" marker after the y
?
Alternatively, maybe you want a "scalar multiply" rather than a "matrix multiply" for this. That is, you don't want to multiply the matrices x and y in the "linear algebra" sense, but you just want to multiply the elements of the arrays, element by element. In that case, you'd do x.*y
(see the dot before the *
?).
Unfortunately, I can't tell which is really correct for your situation without more context. You'll either have to supply some more information or figure it out yourself from the hints I've given.
Upvotes: 1