MATLAB: How to fix error inner matrix dimensions must agree problem

inner matrix dimension

I got this error when i did the multiplication of matrices that consist of both complex numbers ,integers and zeros shown below:
??? Error using ==> mtimes
Inner matrix dimensions must agree.
W1 = P1.*Q1.*V.*P2.*Q2;

Best Answer

You're doing element-by-element multiplication, NOT matrix multiplication, so that means the rows of all 5 matrixes must be the same and the columns of all 5 matrixes must be the same. You do not have that.
But your partial error message indicates that it thinks it's doing a matrix multiplication, not an element-by-element operation. So the columns of the left matrix must match the number of rows in the left matrix. You don't have that either.
Please post the ENTIRE ERROR MESSAGE . This means ALL the red text , not just a paraphrased subset of the message like you did, which probably had an error when you re-wrote it. I know you didn't give the entire error message because the entire error message will always give line numbers and what you showed us did not have that.
Related Question