Take the fft of a rectangular pulse
Afficher commentaires plus anciens
I am trying to plot the fft of a rectangular pulse 'x(t)' and I know that the answer should be a sinc function however that is not what my plot looks like. Perhaps I made an error in my code
clear,clc
ts=10e-3;
t=-2:ts:2;
x=heaviside(t+1)-heaviside(t-1);
fmax=1/ts;
fs=1/4;
freq=0:fs:(fmax);
figure(1)
plot(t,x)
axis([-2 2 -1.5 1.5])
grid 'on'
figure(2)
X=fft(x)/length(x);
plot(freq,X)
Réponses (0)
Catégories
En savoir plus sur Waveform Generation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!