MATLAB: This message appears

errorhelpMATLAB

clear all;
f1=200;
f2=250;
a1=1;
a2=1.5;
fe=10e3;
temps=0:1/fe:0.02-1/fe;
m1=a1*sin(2*pi*f1*temps);
m2=a2*sin(2*pi*f2*temps);
mt=m1*m2;
Error using *
Inner matrix dimensions must agree.

Best Answer

  • It appears because you are multiplying two row vector using matrix mulktiplication.
    You need to use element-wise array multiplication (using .* instead of *):
    mt = m1 .* m2;