fourier transform of Rectangular pulse
조회 수: 6 (최근 30일)
이전 댓글 표시
hi guys. i want to find fourier transform of Rectangular pulse with "fourier" order and i wrote this code:
close all
clear all
double T
T=-10:0.01:10;
f=1*(T>=-1 & T<=1);
plot (T,f)
axis([-3,3,-0.5,2])
FT = fourier (f);
ezplot (FT)
the result:
![2.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/224198/2.jpeg)
this is more info:
![photo5769382595115726351.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/224199/photo5769382595115726351.jpeg)
댓글 수: 0
답변 (1개)
Walter Roberson
2019년 6월 12일
fourier() is the routine from the symbolic toolbox whose primary purpose is to take the fourier transform of formulas .
You do not have a formula, you have double precision data. That calls for fft()
Note: fft() assumes that what you have is infinitely repeatable, that it is a periodic signal. I suspect that if you were to place two copies of your f beside each other and were to look very closely, that you would see that you do not have the period you were expecting. To get the period you are probably expecting, you would have to cut T short by one sample on either the left or the right.
For example it is common for people to do something like sin(linspace(0,2*pi)) and fft that. However, this both begins and ends with 0, and if you were to put two copies beside each other you would get a [0 0] in the middle. To get a continuous signal you would do something like,
T = linspace(0,2*pi);
T(end) = []; %now it does not return to 0
fft(sin(T))
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Spectral Measurements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!