PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Time Domain Representation of Continuous and Discrete Signals 49


>> subplot(3, 1, 1);
>> plot(n, WHAM);
>> title(‘Hamming(31) window’);
>> ylabel(‘Amplitude’);xlabel(‘n’)
>> subplot(3, 1, 2);
>> plot(n, WHAN);
>> title(‘Hanning(31) window’);
>> ylabel(‘Amplitude’);xlabel(‘n’)
>> subplot(3, 1, 3);
>> plot(n, WBLAC);
>> title(‘Blackman(31) window’);
>> xlabel(‘n’);
>> ylabel(‘Amplitude’)

R.1.157 Observe that the Hamming, Hanning, and Blackman window models shown in
Figure 1.39 present similar shapes. They are plotted on the same graph for com-
parison purposes in Figure 1.40, given by script fi le compare_win.

MATLAB Solution
% Script file:compare _ win
% This file returns the plots of the
% HAMMING, HANNING and BLACKMAN windows
% using 31 points.
%*******************************
clc;clf;
n = -15:1:15;

Blackman (31) window

− 15 − 10 − 5 0 5 10

n
15

1

0.5

− 15 −^10 −^5051015

0

Hamming (31) window

Hanning (31) window

1

0.5

− 15
1

− 10 −^5051015

0

Amplitude

Amplitude

Amplitude n

n

0.5

0

FIGURE 1.39
Plots of the Hamming, Hanning, and Blackman windows of R.1.156.
Free download pdf