2015-04-24 60 views
2

我想计算MATLAB的一些功能,我得到这个错误:错误使用*内矩阵维度必须同意

Error using * 
Inner matrix dimensions must agree. 

Error in set1 (line 11) 
x = (Ac + m)*cos(2*pi*fc*t); 

,但我不使用任何类型的矩阵在我的代码。有什么问题?

这里是我的代码:

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; 

回答

2

尝试的elementwise乘以之前*加点:

x = (Ac + m).*cos(2*pi*fc*t); 
+0

谢谢!这是问题所在 – athinatha