在Matlab中绘制系列

时间:2014-09-24 04:09:31

标签: matlab

我是Matlab的新手,我正试图在Matlab中绘制这个函数:

enter image description here 我使用以下代码:

t = -2*pi:0.01:2*pi;
f = sum(cos(2*pi*i*t), i = 1 .. 10);
plot(t, f)

但我收到此消息错误:

f = sum(cos(2*pi*i*t), i = 1 .. 10);
                            |
Error: The expression to the left of the equals sign is not a valid target for an assignment.

任何人都可以帮助我吗?

EDIT: I am using Matlab 2013a

1 个答案:

答案 0 :(得分:2)

 t = -2 * pi : 4 * pi / 500 : 2 * pi;
 f = sum(cos(2 * pi * (1 : 10)' * t), 1);
 plot(t, f);
  • doc sum ,当然))