122 8. FREQUENCY DOMAIN TRANSFORMS
Figure 8.1: Periodicity condition of sampling.
to the other bands of the transform. is is evident in Figure 8.2b by the diminished peak at
250 Hz and increased amplitude of the bands to either side of the peak.
8.3 WINDOWING
Leakage can be reduced by applying a windowing function to the incoming signal. In the time
domain, a windowing function is shaped such that when it is applied to a signal, the beginning
and end taper toward zero. One such window is the Hanning window, shown in Figure 8.3.
An example C code which generates the Hanning window appears below:
float* Hanning(int N) {
float* window = (float*)malloc(N*sizeof(float));
for(i=0; i<N; i++) {
window[i] = (float)((1.0-cos(2.0*M_PI*(i+1)/(N+1)))*0.5);
}
return window;
}