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
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 Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!