I'm trying to calculate some functions in matlab and I'm getting this error:
Error using *
Inner matrix dimensions must agree.
Error in set1 (line 11)
x = (Ac + m)*cos(2*pi*fc*t);
but I don't use any kind of matrix in my code. What is the problem about?
Here is my code:
fs = 10000;
Ts = 1/fs;
t = (0:Ts:10);
m = cos(2*pi*t);
plot(t,m);
figure;
Ac = 2;
fc = 500;
x = (Ac + m)*cos(2*pi*fc*t);
plot(t,x);
figure;
Try elementwise multiplication by adding a dot before *:
x = (Ac + m).*cos(2*pi*fc*t);