510 Practical MATLAB® Applications for Engineers
figure(6)
W=linspace(-2*pi,2*pi,100);
DTFT _ f1=1./(1-0.3*exp(-j.*W));
DTFT _ f2=1./(1-0.9*exp(-j.*W));
subplot (2,1,1)
plot (W,abs(DTFT _ f1));title(‘ DTFT[f1(n)]=1./(1-0.3*exp(-j.*W))’);
xlabel (‘frequency W ’), ylabel(‘Magnitude’)
subplot (2,1,2)
plot (W,angle(DTFT _ f1));
xlabel (‘frequency W’), ylabel(‘Phase angle in rad.’)figure(7)
subplot(2,1,1)
plot(W,abs(DTFT _ f2));title(‘ DTFT[f2(n)]=1./(1-0.9*exp(-j.*W))’);
xlabel(‘frequency W ’), ylabel(‘Magnitude’)
subplot(2,1,2)
plot(W,angle(DTFT _ f2));
xlabel(‘frequency W ’), ylabel(‘Phase angle in rad.’)The script fi le DTFT_properties is executed and the results are shown in Figures 5.21
through 5.27.000.20.40.60.8Amplitude of f1(n)1− 4 − 2 246810f1(n) versus ntime index n000.20.40.60.8Amplitude of f2(n)1− 4 − 2 246810f2(n) versus ntime index nFIGURE 5.21
Discrete plots of f 1 (n) and f 2 (n) of Example 5.2.