PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

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.

0

0

0.2

0.4

0.6

0.8

Amplitude of f1(n)

1

− 4 − 2 246810

f1(n) versus n

time index n

0

0

0.2

0.4

0.6

0.8

Amplitude of f2(n)

1

− 4 − 2 246810

f2(n) versus n

time index n

FIGURE 5.21
Discrete plots of f 1 (n) and f 2 (n) of Example 5.2.

Free download pdf