Time Domain Representation of Continuous and Discrete Signals 63
subplot(2,2,1);
stem (n, real(fn)); hold on; plot(n,yzero);
title (‘real part of [f(n)] vs. n’)
ylabel(‘real part of [f(n)]’);
axis([0 15 -2 3])
subplot(2,2,2);
stem(n, imag(fn));
hold on;plot(n,yzero);
ylabel(‘imaginary part of [f(n)]’)
title(‘imaginary part of [f(n)] vs. n’)
ylabel(‘imaginary part of [f(n)]’);
axis([0 15 -2 2])
subplot(2,2,3);
stem(n, abs(fn));
title(‘magnitude of [f(n)] vs. n’)
xlabel(‘time index n’)
ylabel(‘magnitude of [f(n)]’)
subplot(2,2,4);
stem(n,(180/pi) * angle(fn));
hold on; plot(n,yzero);
title(‘phase of [f(n)] vs n’)
xlabel(‘time index n’)
ylabel(‘degrees’)
The script fi le disc_plots is executed and the results are shown in Figure 1.54.
real part of [f(n)] versus n imaginary part of [f(n)] versus n
real part of [f(n)]
imaginary part of [f(n)]
3
2
1
− 1
− 2
0 51015
0
2
0
− 1
− 2
0 51015
1
magnitude of [f(n)] versus n
3
2
1
0
0 5 10 15
magnitude of [f(n)]
time index n time index n
degrees
200
100
− 100
− 200
0
0 5 10 15
phase of [f(n)] versus n
FIGURE 1.54
Plots of Example 1.6.