MATLAB Answers

0

fourier transform of Rectangular pulse

Asked by HADIMARGO on 12 Jun 2019
Latest activity Answered by 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

  0 Comments

Sign in to comment.

1 Answer

Answer by 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))

  0 Comments

Sign in to comment.