开发者

Help with matlab and fourier series

This is the fourier series I've calculated using wolfram alpha

ht开发者_开发问答tp://www.wolframalpha.com/input/?i=(i*0.5)/(2*pi*-2)*e^(i*-4*pi*x/0.5)%2B(i*0.5)/(-2*pi)*e^(-i*2*pi*x/0.5)%2B(0.5/2)*1%2B(i*0.5)/(2*pi)*e^(i*2*pi*x/0.5)%2B(i*0.5)/(4*pi)*e^(i*4*pi*x/0.5)

This is how I write in matlab for eg C(-2)

(0.5*i/2*pi*-2)*exp(1).^(i*2*-2*pi*x/0.5)+....

But the plot is not at all close to the original, what am I doing wrong?


As a followup from Ben's point, always use 1i instead of i, because it will withstand the use of i as a local variable.


You have not parenthesized the expression the same (eg consider /(2*pi*-2) vs /2*pi*-2). It's also possible you used i as an index variable in your workspace and it is no longer the complex value sqrt(-1).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜