Take 512 samples of speech, as in figure 19:

Figure 19: A segment of a vowel extracted with a rectangular window
Perform FFT and plot the magnitude of the result:

Figure 20: The amplitude spectrum using a rectangular window
Calculated using Matlab: abs(fft(sig))
As can be seen from figure 19, there is a sharp discontinuity at the ends. Application of the Hamming window reduces this discontinuity:

Figure 21: A segment of a vowel extracted with a hamming window.
Calculated using Matlab: hamming(512) .* sig
And as a result the harmonic structure of the speech is more visible:

Figure 22: The amplitude spectrum using a hamming window.
Calculated using Matlab: abs(fft(hamming(512) .* sig))
This is the basis for most computer generated spectrograms (display pixel intensity on a log scale by limiting the dynamic range to about 60-80 dB).

Figure 23: The power spectrum displayed on a dB scale.
Calculated using Matlab: 10 log10(abs(fft(hamming(512) .* sig)))
To illustrate the effect of window size the above analysis has been repeated using a hamming window of length 64. The speech is illustrated in figure reffig:hammsigshort which shows that less than one pitch period is included in the analysis window. Hence it is not possible to resolve the harmonics in the DFT, but only display the broad formant patterns of the speech (figure 25).

Figure 24: A segment of a vowel extracted with a hamming window of length 64

Figure 25: The amplitude spectrum using a hamming window of length 64