MATLAB: “Matrix dimensions must agree”

MATLABmatrixplotplotting

Matrix dimensions must agree

Best Answer

Of course it gives you an error. In your script
x=0:0.01:6
is a vector of size 1x601. When you do elementwise multiplication
M=eye(3).*x;
you are trying to multiply a 3x3 matrix with a 1x601 vector, which is impossible.
Related Question