x={0.5,0.53,0.56,0.6}; N=length(x); for m=1:N S=2*cos(2*pi*x(m)*u)+S; end
提示:
Undefined operator '*' for input arguments of type 'cell'.
是因为x(m)不是一个数,而是一个列表,需将x改为x=[0.5,0.53,0.56,0.6];