Take the fft of a rectangular pulse
이전 댓글 표시
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)
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Waveform Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!