fourier transform of Rectangular pulse

47 views (last 30 days)
HADIMARGO
HADIMARGO on 12 Jun 2019
Answered: Walter Roberson on 12 Jun 2019
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
this is more info:
photo5769382595115726351.jpg

Answers (1)

Walter Roberson
Walter Roberson on 12 Jun 2019
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))

Community Treasure Hunt

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

Start Hunting!