fft of a rectangular vs closed form expression

1 view (last 30 days)
Hi there, I am trying to do compare the FFT of a box function vs the closed form expression, but they seem to be out of scale. I am sure I must be doing something wrong...anybody can give me a hint ? Here is the code ( I know the phase is off ), the magnitude seem OK however is totally out of scale ...
dt = 2e-12; time = [0:dt:100e-9]; fun3 = zeros(1,length(time)); fun3(1,1001:1100) = ones(1,100);t1 = time(1001) t2 = time(1100) deltat = (t2-t1)/2; tmed = (t2+t1)/2; freq = [0:length(time)-1]/time(length(time))-1/(2*dt); ffuna = 2*deltat*sin(2*pi*freq*deltat)./(2*pi*freq*deltat); Nfft3 = length(fun3); ffun3 = fft(fun3,Nfft3)/Nfft3; ffun3 = fftshift(ffun3);
Thanks, Giuseppe

Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!