Fourier Transform of 4 cycles of cosine

2 次查看(过去 30 天)
I was given an exercise in class about plotting the Fourier transform of the cos(4*pi*t) for 4 cycles. I have tried the exercise, but I don't quite get the result expected. This is what I have attepted so far, can anybody help me? I am given an increment of t that is 0.01.
delta_t=0.01; T=2*pi; w=-0:delta_w:T; X=zeros(size(w)); for k=1:length(w) X(k)=sum(x.*exp(-1i*w(k)*cos(4*pi*t))); end
plot(w,abs(X));
THANK YOU
  1 个评论
John D'Errico
John D'Errico 2018-11-8
编辑:John D'Errico 2018-11-8
Is this what you expected?
Undefined function or variable 'delta_w'.
If not, then you need to define delta_w.
Ok, maybe you meant delta_w is 0.01. But then you should recognize that 2*pi does not divide evenly into increments of 0.01. So the last point will not be 2*pi, but some small amount off.
And, oh, what is the difference between -0 and 0? That new math stuff. I'll never understand it.
Hmm. What else. Do you think that cos(4*pi*T) covers 4 cycles? Since T=2*pi, then 4*pi*T=8*pi^2.
Since the cos function is periodic on the interval 2*pi, then 4 cycles would be 8*pi.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by