DTFT, DFT, ZT, and FFT 539
0
0
0.5
1
Amplitude1.5
2
2.5
3
3.5
0.1 0.2 0.3 0.4 0.5 0.6
time
0.7 0.8 0.9 1
[f(t)=3*exp(-5*t)] versus t
FIGURE 5.52
Plot of f(t) over the range 0 ≤ t ≤ 1 of Example 5.12.
axis([-1e4 1e4 0 0.01])
subplot (2,1,2)
plot (W,angle(Fdc));title(‘angle[DFT[f(n)]] vs w’);ylabel(‘Phase’);
xlabel (‘frequency w ’);
figure(3) % analog frequency analysis
F _ table = 3./(5+j*W);
subplot (2,1,1)
absF _ table = abs(F _ table);
plot(W(200:400),absF _ table(200:400));
title(‘abs[FT[f(t)]] vs w’);
ylabel(‘Magnitude’);axis([-.1e4 .1e4 0 0.8]);
subplot (2,1,2)
plot (W,angle(F _ table));title(‘angle[FT[f(t)]] vs w’);ylabel(‘Phase’);
xlabel (‘frequency w ‘);axis([-1e4 1e4 -2 2]);
figure(4) % error analysis in frequency
error _ mag = abs(F _ table)-abs(Fdc);
error _ phase = angle(F _ table)-angle(Fdc);
subplot (2,1,1)
plot (W(200:400) ,error _ mag(200:400));axis([-.2e4 .2e4 0 0.8]);
title (‘error mag.=abs[FT[f(t)]]-abs[DFT[f(n)]] vs w n’);
ylabel (‘Magnitude’); xlabel (‘index n’)
subplot(2,1,2)
bar(W,error _ phase);title(‘error phase=angle[FT[f(t)]-angle[DFT[f(n)]]
vs w’);
ylabel(‘Phase’);xlabel(‘frequency w’);
The script fi le FT_DFT is executed, and the results are as follows:
>> FT _ DFT