Fourier Transform of 4 cycles of cosine

3 Ansichten (letzte 30 Tage)
Carlota Trigo
Carlota Trigo am 8 Nov. 2018
Bearbeitet: John D'Errico am 8 Nov. 2018
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 Kommentar
John D'Errico
John D'Errico am 8 Nov. 2018
Bearbeitet: John D'Errico am 8 Nov. 2018
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by