2.4 Examples
This chapter discusses various FIR filter design methods. It also provides examples of all types of filters as well as of all methodes described in the previous chapters. The four standard types of filters are used here:
The design method used here is known as the window method.
The FIR filter design process can be split into several steps as described in Chapter 2.2.4 entitled
Designing FIR filters using window functions. These are:

 Defining filter specifications;

 Specifying a window function according to the filter specifications;

 Computing the filter order according to the filter specifications and specified window function;

 Computing the coefficients of the window;

 Computing the ideal filter coefficients according to the filter order;

 Computing the FIR filter coefficients according to the obtained window function and ideal filter coefficients; and

 If the resulting filter has too wide or too narrow transition region, it is necessary to change the filter order. The specified filter order is increased or decreased according to needs, and steps 4, 5 and 6 are repeated after that as many times as needed.
Depending on the window function in use, some steps will be skipped. If the filter order is known, step 3 is skipped. If the window function to use is predetermined, step 2 is skipped.
In every given example, the FIR filter design process will be described through these steps in order to make it easier for you to note similarities and differencies between various design methodes, window functions and design of various types of filters as well.
2.4.1 Filter design using Rectangular window
2.4.1.1 Example 1
Step 1:
Type of filter – lowpass filter
Filter specifications:

 Sampling frequency – fs=20KHz

 Passband cutoff frequency – fc=2.5KHz
Step 2:
Method – filter design using rectangular window
Step 3:
Filter order is predetermined, N=10;
A total number of filter coefficients is larger by one, i.e. N+1=11; and
Coefficients have indices between 0 and 10.
Step 4:
All coefficients of the rectangular window have the same value equal to 1.
w[n] = 1 ; 0 ≤ n ≤10
Step 5:
The ideal lowpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc can be calculated using the following expression:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal lowpass filter:
The middle element is found via the following expression
Step 6:
The designed FIR filter coefficients are obtained via the following expression:
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 241 illustrates the direct realization of designed FIR filter, whereas Figure 242 illustrates the optimized realization of designed FIR filter, which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 241. FIR filter direct realization
Figure 242. Optimized realization structure of FIR filter
2.4.1.2 Example 2
Step 1:
Type of filter – highpass filter
Filter specifications:

 Sampling frequency– fs=20KHz

 Passband cutoff frequency – fc=5KHz
Step 2:
Method – filter design using rectangular window
Step 3:
Filter order is predetermined, N=8;
A total number of filter coefficients is larger by 1, i.e. N+1=9;
Coefficients have indices between 0 and 8.
Step 4:
All coefficients of the rectangular window have the same value equal to 1.
w[n] = 1 ; 0 ≤ n ≤ 8
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc can be calculated using the following expression:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal lowpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 243 illustrates the direct realization of designed FIR filter, whereas figure 244 illustrates the optimized realization of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 243. FIR filter direct realization
Figure 244. FIR filter optimized realization structure
2.4.1.3 Example 3
Step 1:
Type of filter – bandpass filter
Filter specifications:

 Sampling frequency – fs=20KHz

 Passband cutoff frequency – fc1=3KHz, fc2=5.5KHz
Step 2:
Method – filter design using rectangular window
Step 3:
Filter order is predetermined, N=14
A total number of filter coefficients is larger by 1, i.e. N+1=15.
Coefficients have indices between 0 and 14.
Step 4:
All coefficients of the rectangular window have the same value equal to 1.
w[n] = 1 ; 0 ≤ n ≤14
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequencies ωc1 and ωc2 can be found using the following expressions:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc1 and ωc2 with expression for the impulse response coefficients of the ideal bandpass filter:
Step 7:
Filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 245 illustrates the direct realization of designed FIR filter, whereas figure 246 illustrates optimized realization of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 245. FIR filter direct realization
Figure 246. FIR filter optimized realization structure
2.4.1.4 Example 4
Step 1:
Type of filter – bandstop filter
Filter specifications:

 Sampling frequency – fs=20KHz

 Stopband cutoff frequency  fc1=3KHz, fc2=5.5KHz
Step 2:Method – filter design using rectangular windowStep 3:
Filter order is predetermined, N=14;
A total number of filter coefficients is larger by 1, i.e. N+1=15; and
Coefficients have indices between 0 and 14.
Step 4:
All coefficients of the rectangular window have the same value equal to 1.
w[n] = 1 ; 0 ≤ n ≤ 14
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequencies ωc1 and ωc2 can be found using expressions:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc1 and ωc2 with expression for the impulse response coefficients of the ideal bandstop filter:
Note that, excepting the middle element, all coefficients are the same as in the previous example (bandpass filter with the same cutoff frequencies), but have the opposite sign.
Step 6:
The designed FIR filter coefficients are found via expression:
The FIR filter coefficients h[n], rounded to 6 digits, are:
Step 7:
Filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 247 illustrates the direct realization of designed FIR filter, whereas figure 248 illustrates optimized realization of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 247. FIR filter direct realization
Figure 248. FIR filter optimized realization structure
2.4.2 Filter design using Bartlett window
2.4.2.1 Example 1
Step 1:
Type of filter – lowpass filter
Filter specifications:

 Sampling frequency – fs=20KHz

 Passband cutoff frequency – fc=2.5KHz
Step 2:
Method – filter design using Barlett window
Step 3:
Filter order is predetermined, Nf=9;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=10; and
Coefficients have indices between 0 and 8.
Step 4:
The coefficients of Bartlett window are expressed as:
Step 5:
The ideal lowpass filter coefficients (ideal filter impulse response) are given in the expression below:
where M is the index of middle coefficient.
Since the value of M is not an integer, the middle element representing a center of coefficients symmetry doesn’t exist.
Normalized cutoff frequency ωc can be calculated using expression:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal lowpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤9
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 249 illustrates the direct realization of designed FIR filter, whereas figure 2410 illustrates optimized realization of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 249. FIR filter direct realization
Figure 2410. FIR filter optimized realization structure
2.4.2.2 Example 2
Step 1:
Type of filter – highpass filter
Filter specifications:

 Sampling frequency – fs=20KHz

 Passband cutoff frequency – fc=5KHz
Step 2:
Method –filter design using Bartlett window
Step 3:
Filter order is predetermined, Nf=8;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=9;
Coefficients have indices between 0 and 8.
Step 4:
The Bartlett window function coefficients are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc may be calculated via the following expression:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal highpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 8
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
Filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2411 illustrates the direct realization of designed FIR filter, whereas figure 2412 illustrates optimized realization of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2411. FIR filter direct realization
Figure 2412. FIR filter optimized realization structure
2.4.2.3 Example 3
Step 1:
Type of filter – bandpass filter
Filter specifications:

 Sampling frequency – fs=20KHz; and

 Passband cutoff frequencies – fc1=3KHz, fc2=5.5KHz.
Step 2:
Method – filter design using Bartlett window
Step 3:
Filter order is predetermined, Nf=14;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=15; and
Coefficients have indices between 0 and 14.
Step 4:
The Balett window coefficients are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequencies ωc1 and ωc2 can be calculated using expressions:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc1 and ωc2 with expression for the impulse response coefficients of the ideal bandpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 14
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2413 illustrates the direct realization of designed FIR filter, whereas figure 2414 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2413. FIR filter direct realization
Figure 2414. FIR filter optimized realization structure
2.4.2.4 Example 4
Step 1:
Type of filter – bandstop filter
Filter specifications:

 Sampling frequency – fs=20KHz; and

 Stopband cutoff frequencies – fc1=3KHz, fc2=5.5KHz.
Step 2:
Method – filter design using Bartlett window
Step 3:
Filter order is predetermined, Nf=14;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=15; and
Coefficients have indices between 0 and 14.
Step 4:
The coefficients of Bartlett window are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequencies ωc1 and ωc2 can be calculated using expressions:
The values of coefficients (rounded to six digits) are obtained by combining the values of M, ωc1 and ωc2 with expression for the impulse response coefficients of the ideal bandstop filter:
Note that, excepting the middle element, all the coefficients are the same as in the previous example (bandpass filter with the same cutoff frequencies), but have the opposite sign.
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 14
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2415 illustrates the direct realization of designed FIR filter, whereas figure 2416 illustrates optimized realization of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2415. FIR filter direct realization
Figure 2416. FIR filter optimized realization structure
It is determined on purpose that FIR filters, explained in examples 3 and 4, have the same order. The similarity between the coefficients of bandpass and bandstop FIR filters is obvious. All coefficients of the bandstop FIR filter have the same absolute values as the corresponding coefficients of the bandpass FIR filter. The only difference is that they are of the opposite sign. The middle element of the bandstop filter is defined as:
bbs = 1  bbp
where:

 bbs is the middle coefficient of the bandstop filter; and

 bbp is the middle coefficient of the bandpass filter.
Because of such similarity, it is easy to convert a bandpass FIR filter into a bandstop FIR filter having the same cutoff frequencies, sampling frequency and filter order.
Besides, lowpass and highpass FIR filters are interrelated in the same way, which can be seen in examples describing Hann window.
2.4.3 Filter design using Hann window
2.4.3.1 Example 1
Step 1:
Type of filter – lowpass filter
Filter specifications:

 Sampling frequency – fs=20KHz; and

 Passband cutoff frequency – fc=2.5KHz.
Step 2:
Method – filter design using Hann window
Step 3:
Filter order is predetermined, Nf=10;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=11; and
Coefficients have indices between 0 and 10.
Step 4:
The Hann window function coefficients are found via expression:
Step 5:
The ideal lowpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc can be calculated using expression:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse reaponse coefficients of the ideal lowpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 10
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2417 illustrates the direct realization of designed FIR filter, whereas figure 2418 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2417. FIR filter direct realization
Figure 2418. FIR filter optimized realization structure
2.4.3.2 Example 2
Step 1:
Filter type – highpass filter Filter specifications:

 Sampling frequency – fs=20KHz; and

 Passband cutoff frequency – fc=2.5KHz.
Step 2:
Method –filter design using Hann window
Step 3:
Filter order is predetermined, Nf=10;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=11; and
Coefficients have indices between 0 and 10.
Step 4:
The Hann window function coefficients are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc can be calculated using expression:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal highpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 10
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2419 illustrates the direct realization of designed FIR filter, whereas figure 2420 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2419. FIR filter direct realization
Figure 2420. FIR filter optimized realization structure
2.4.3.3 Example 3
Step 1:
Type of filter – bandpass filter
Filter specifications:

 Sampling frequency – fs=20KHz; and

 Passband cutoff frequency – fc1=3KHz, fc2=5.5KHz.
Step 2:
Method – filter design using Hann window
Step 3:
Filter order is predtermined, Nf=14;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=15; and
Coefficients have indices between 0 and 14.
Step 4:
The Hann window function coefficients are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequencies ωc1 and ωc2 can be calculated using expressions:
The values of coefficients (rounded to six digits) are obtained by combining the values of M, ωc1 and ωc2 with expression for the impulse response coefficients of the ideal bandpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 14
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2421 illustrates the direct realization of designed FIR filter, whereas figure 2422 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2421. FIR filter direct realization
Figure 2422. FIR filter optimized realization structure
2.4.3.3 Example 3
Step 1:
Type of filter – bandstop filter
Filter specifications:

 Sampling frequency – fs=20KHz; and

 Passband cutoff frequency – fc1=3KHz, fc2=5.5KHz.
Step 2:
Method – filter design using Hann window
Step 3:
Filter order is predetermined, Nf=14;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=15;
Coefficients have indices between 0 and 14.
Step 4:
The Hann window function coefficients are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequencies ωc1 and ωc2 can be calculated using expressions:
The values of coefficients (rounded to six digits) are obtained by combining the values of M, ωc1 and ωc2 with expression for the impulse response coefficients of the ideal bandstop filter:
Note that, excepting the middle element, all coefficients are the same as in the previous example (bandpass filter with the same cutoff frequencies), but have the opposite sign.
Step 6:
The designed FIR filter coefficients are found via expression:
h[n]=w[n] * hd[n] ; 0 ≤ n ≤ 14
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2423 illustrates the direct realization of designed FIR filter, whereas figure 2424 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2423. FIR filter direct realization
Figure 2424. FIR filter optimized realization structure
It is specified on purpose that FIR filters, explained in examples 1 and 2, have the same order. The similarity between lowpass and highpass FIR filter coefficients is obvious. All coefficients of the lowpass FIR filter have the same absolute values as the corresponding coefficients of the highpass FIR filter. The only difference is that they are of the opposite sign. The middle element is defined as:
blp = 1  bhp
where:

 blp is the middle coefficient of a lowpass filter; and

 bhp is the middle coefficient of a highpass filter.
Because of such similarity, it is easy to convert a lowpass FIR filter into a highpass FIR filter having the same cutoff frequencies, sampiling frequency and filter order.
2.4.4 Filter design using BartlettHanning window
2.4.4.1 Example 1
Step 1:
Type of filter – lowpass filter
Filter specifications:

 Sampling frequency – fs=22050Hz; and

 Passband cutoff frequency – fc=4KHz.
Step 2:
Method – filter design using BartlettHanning window
Step 3:
Filter order is predetermined, Nf=9;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=10; and
Coefficients have indices between 0 and 9.
Step 4:
The BartlettHanning window function coefficients are found via expression:
Step 5:
The ideal lowpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc can be calculated using expression:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal lowpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 9
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2425 illustrates the direct realization of designed FIR filter, whereas figure 2426 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2425. FIR filter direct realization
Figure 2426. FIR filter optimized realization structure
2.4.4.2 Example 2
Step 1:
Type of filter – highpass filter
Filter specifications:

 Sampling frequency – fs=22050Hz; and

 Passband cutoff frequency – fc=4KHz.
Step 2:
Method – filter design using BartlettHanning window
Step 3:
Filter order is predetermined, Nf=10;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=11; and
Coefficients have indices between 0 and 10.
Step 4:
The BartlettHanning window function coefficients are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc may be calculated using expression:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal highpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 10
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2427 illustrates the direct realization of designed FIR filter, whereas figure 2428 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2427. FIR filter direct realization
Figure 2428. FIR filter optimized realization structure
2.4.4.3 Example 3
Step 1:
Type of filter – bandpass filter
Filter specifications:

 Sampling frequency – fs=22050Hz; and

 Passband cutoff frequency – fc1=2KHz, fc2=5KHz.
Step 2:
Method – filter design using BartlettHanning window
Step 3:
Filter order is predetermined, Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13; and
Coefficients have indices between 0 and 12.
Step 4:
The BartlettHanning window function coefficients are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequencies ωc1 and ωc2 can be calculated using expressions:
The values of coefficients (rounded to six digits) are obtained by combining the values of M, ωc1 and ωc2 with expression for the impulse response coefficients of the ideal bandpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 12
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2429 illustrates the direct realization of designed FIR filter, whereas figure 2430 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2429. FIR filter direct realization
Figure 2430. FIR filter optimized realization structure
2.4.4.4 Example 4
Step 1:
Type of filter – bandstop filter
Filter specifications:

 Sampling frequency – fs=22050Hz; and

 Passband cutoff frequencies – fc1=2KHz, fc2=6KHz.
Step 2:
Method – filter design using BartlettHanning window
Step 3:
Filter order is predetermined, Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13; and
Coefficients have indices between 0 and 12.
Step 4:
The BartlettHanning window function coefficients are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequencies ωc1 and ωc2 can be calculated using expressions:
The values of coefficients (rounded to six digits) are obtained by combining the values of M, ωc1 and ωc2 with expression for the impulse reaponse coefficients of the ideal bandstop filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 12
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2431 illustrates the direct realization of designed FIR filter, whereas figure 2432 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2431. FIR filter direct realization
Figure 2432. FIR filter optimized realization structure
2.4.5 Filter design using Hamming window
2.4.5.1 Example 1
Step 1:
Type of filter – lowpass filter
Filte specifications:

 Sampling frequency – fs=22050Hz;

 Passband cutoff frequency – fc1=3KHz;

 Stopband cutoff frequency – fc2=6KHz; and

 Minimum stopband attenuation – 40dB.
Step 2:
Method – filter design using Hamming window
Step 3:
For the first iteration, the filter order can be determined from the table 241 below.
WINDOW FUNCTION 
NORMALIZED LENGTH OF THE MAIN LOBE FOR N=20 
TRANSITION REGION FOR N=20 
MINIMUM STOPBAND ATTENUATION OF WINDOW FUNCTION 
MINIMUM STOPBAND ATTENUATION OF DESIGNED FILTER 

Rectangular 
0.1π 
0.041π 
13 dB 
21 dB 
Triangular (Bartlett) 
0.2π 
0.11π 
26 dB 
26 dB 
Hann 
0.21π 
0.12π 
31 dB 
44 dB 
BartlettHanning 
0.21π 
0.13π 
36 dB 
39 dB 
Hamming 
0.23π 
0.14π 
41 dB 
53 dB 
Bohman 
0.31π 
0.2π 
46 dB 
51 dB 
Blackman 
0.32π 
0.2π 
58 dB 
75 dB 
BlackmanHarris 
0.43π 
0.32π 
91 dB 
109 dB 
Table 241. Comparison of window functions
Using the specifications for the transition region of the required filter, it is possible to compute cutoff frequencies:
The required transition region of the filter is:
The transition region of the filter to be designed is approximately twice that of the filter given in the table above. For the first iteration, the filter order can be half of that.

 A total number of filter coefficients is larger by 1, i.e. N=Nf+1=11; and

 Coefficients have indices between 0 and 10.
Step 4:
The Hamming window function coefficients are found via expression:
Step 5:
The ideal lowpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc can be calculated using expression:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal lowpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 10
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
Analyse in the frequency domain is performed using the Filter Designer Tool program.
Figure 2433. Frequency characteristic of the resulting filter
Figure 2433 illustrates the frequency characteristic of the resulting filter. It is obtained in the
Filter Designer Tool program. As seen, the resulting filter doesn’t satisfy the required specifications. The attenuation at the frequency of 6KHz amounts to 32.96dB only, which is not sufficient. It is necessary to increase the filter order.
Another way is to compute the attenuation at the frequency of 6KHz. Starting from the impulse response, the first thing that should be done is the Ztransform. It is explained, along with Fourier transformation, in chapter 222.
It is easy to obtain the Fourier transformation via the Ztransform:
According to the analyse performed using Filter Designer Tool, it is confirmed that the filter order has to be incremented.
The filter order is incremented by two. The whole process of designing filter is repeated from the step 3.
Step 3:
Filter order is Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13; and
Coefficients have indices between 0 and 12.
Step 4:
The Hamming window function coefficients are found via expression:
Step 5:
The ideal lowpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc can be calculated using expression:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal lowpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 12
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
Analyse in the frequency domain is performed using the Filter Designer Tool program.
Figure 2434. Frequency characteristic of the resulting filter
Figure 2434 illustrates the frequency characteristic of the resulting filter. As seen, the resulting filter doesn’t satisfy the given specifications. The attenuation at the frequency of 6KHz amounts to 45.26dB only, which is not sufficient. It is necessary to change the filter order.
Filter realization:
Figure 2435 illustrates the direct realization of designed FIR filter, whereas figure 2436 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2435. FIR filter direct realization
Figure 2436. FIR filter optimized realization structure
2.4.5.2 Example 2
Step 1:
Type of filter – highpass filter
Filte specifications:

 Sampling frequency – fs=22050Hz; and

 Passband cutoff frequency – fc=4KHz.
Step 2:
Method – filter design using Hamming window
Step 3:
Filter order is predetermined, Nf=10;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=11; and
Coefficients have indices between 0 and 10.
Step 4:
The Hamming window function coefficients are found via expression:
The Hamming window function is one of rare standard windows where w[0] > 0 is in effect.
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc can be calculated using expression:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal highpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 10
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2437 illustrates the direct realization of designed FIR filter, whereas figure 2438 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2437. FIR filter direct realization
Figure 2438. FIR filter optimized realization structure
2.4.5.3 Example 3
Step 1:
Type of filter – bandpass filter
Filte specifications:

 Sampling frequency – fs=16KHz;

 Passband cutoff frequency – fc1=2KHz, fc2=5KHz.
Step 2:
Method – filter design using Hamming window
Step 3:
Filter order is predetermined, Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13; and
Coefficients have indices between 0 and 12.
Step 4:
The Hamming window function coefficients are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequencies ωc1 and ωc2 can be calculated using expressions:
The values of coefficients (rounded to six digits) are obtained by combining the values of M, ωc1 and ωc2 with expression for the impulse response coefficients of the ideal bandpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 12
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2439 illustrates the direct realization of designed FIR filter, whereas figure 2440 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle elements.
Figure 2439. FIR filter direct realization
Figure 2440. FIR filter optimized realization structure
2.4.5.4 Example 4
Step 1:
Type of filter – bandstop filter
Filte specifications:

 Sampling frequency – fs=16000Hz; and

 Passband cutoff frequency – fc1=2KHz, fc2=6KHz.
Step 2:
Method – filter design using Hamming window
Step 3:
Filter order is predetermined, Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13; and
Coefficients have indices between 0 and 12.
Step 4:
The BartlettHanning window function coefficients are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequencies ωc1 and ωc2 can be calculated using expressions:
The values of coefficients (rounded to six digits) are obtained by combining the values of M, ωc1 and ωc2 with expression for the impulse response coefficients of the ideal bandstop filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 12
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2441 illustrates the direct realization of designed FIR filter, whereas figure 2442 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2441. FIR filter direct realization
Figure 2442. FIR filter optimized realization structure
The first example (lowpass filter designed using Hamming window) explains the algorithm used to compute the needed filter order when it is unknown. The filter order can also be found using Kaiser window, after which the number of iterations, i.e. correction steps is reduced.
The forth example explains the way of designing a bandstop filter. As can be seen, the impulse response of the resulting filter contains large number of zero values, which results in reducing the number of multiplication operations in design process. These zeros appear in impulse response because of the stopband width which amounts to 0.5π = π/2.
If it is possible to specify the sampling frequency from a certain frequency range, you should tend to specify the value representing a multiple of the passband width. The number of zeros contained in an impulse response is larger in this case, whereas the number of multiplications, otherwise the most demanding operation in filtering process, is less.
In the given example, only 5 multiplication operations are performed in direct realization of a twelfthorder FIR filter, i.e. 3 multiplication operations in optimized realization structure.
2.4.6 Filter design using Bohman window
2.4.6.1 Example 1
Step 1:
Type of filter – lowpass filter
Filte specifications:

 Sampling frequency – fs=20KHz; and

 Passband cutoff frequency – fc=5KHz.
Step 2:
Method – filter design using Bohman window
Step 3:
Filter order is Nf=10;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=11; and
Coefficients have indices between 0 and 10.
Step 4:
The Bohman window function coefficients are found via expression:
Step 5:
The ideal lowpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc may be computed using expression:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal lowpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 10
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2443 illustrates the direct realization of designed FIR filter, whereas figure 2444 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2443. FIR filter direct realization
Figure 2444. FIR filter optimized realization structure
2.4.6.2 Example 2
Step 1:
Type of filter – highpass filter
Filte specifications:

 Sampling frequency – fs=22050Hz;

 Passband cutoff frequency – fc1=1.5KHz;

 Stopband cutoff frequency – fc2=4KHz; and

 Minimum stopband attenuation – 35dB.
Step 2:
Method – filter design using Bohman window
Step 3:
The needed filter order is determined via iteration.
It is necessary to specify the initial value of filter order that is to be changed as many times as needed. This value is specified according to the data contained in the table 242 below:
WINDOW FUNCTION 
NORMALIZED LENGTH OF THE MAIN LOBE FOR N=20 
TRANSITION REGION FOR N=20 
MINIMUM STOPBAND ATTENUATION OF WINDOW FUNCTION 
MINIMUM STOPBAND ATTENUATION OF DESIGNED FILTER 

Rectangular 
0.1π 
0.041π 
13 dB 
21 dB 
Triangular (Bartlett) 
0.2π 
0.11π 
26 dB 
26 dB 
Hann 
0.21π 
0.12π 
31 dB 
44 dB 
BartlettHanning 
0.21π 
0.13π 
36 dB 
39 dB 
Hamming 
0.23π 
0.14π 
41 dB 
53 dB 
Bohman 
0.31π 
0.2π 
46 dB 
51 dB 
Blackman 
0.32π 
0.2π 
58 dB 
75 dB 
BlackmanHarris 
0.43π 
0.32π 
91 dB 
109 dB 
Table 242. Comparison of window functions
According to the specifications for the transition region of required filter, it is possible to compute cutoff frequencies:
The required transition region is:
The transition region of the filter to be designed is somewhat wider than that of the filter given in table 242. For the first iteration, during filter design process, the filter order can be lower.
Unlike the lowpass FIR filter, the highpass FIR filter must be of even order. The same applies to bandpass and bandstop filters. It means that filter order can be changed in odd steps. The smallest change is ±2. In this case, the filter order, comparing to that from the table (20), can be decreased by 2 for the purpose of defining initial value.
Filter order is Nf=18;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=19; and
Coefficients have indices between 0 and 18.
Step 4:
The coefficients of Bohman window are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc is equal to passband cutoff frequency:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal highpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 18
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
Analyse in the frequency domain is performed using the
Filter Designer Tool program.
Figure 2445. Frequency characteristics of the resulting filter
Figure 2445 illustrates the frequency characteristic of the resulting filter. It is obtained in the
Filter Designer Tool program. As seen, the resulting filter satisfies the required specifications. The attenuation at the frequency of 1500Hz amounts to 37.04dB only, which is more than enough. However, the final objective when designing a filter is to find a minimum filter order that satisfies the filter specifications.
Since the filter order must be changed by an even number, the specified value is 2. The filter order is decreased by 2. The whole process of designing filters is repeated from the step 3 on.
Step 3:
Filter order is Nf=16;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=17; and
Coefficients have indices between 0 and 16.
Step 4:
The coefficients of Bohman window are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc is equal to the passband cutoff frequency:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal highpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 16
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
Analyse in the frequency domain is performed using the Filter Designer Tool program.
Figure 2446. Frequency characteristic of the resulting filter
Figure 2446 illustrates the frequency characteristic of the resulting filter. The figure is obtained in the
Filter Designer Tool program. As seen, the resulting filter satisfies the required specifications. The objective is to find the minimum filter order. Since the attenuation is close to the required attenuation, the correct order is probably 16. However, it is necessary to check it.
Since the filter order must be changed by an even number, the specified value is 2. The filter order is decreased by 2, therefore. The whole process of designing filter is repeated from the step 3 on.
Step 3:
Filter order is predetermined, Nf=14;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=15; and
Coefficients have indices between 0 and 14.
Step 4:
The coefficients of Bohman window are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc is equal to passband cutoff freqency:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse reaponse coefficients of the ideal highpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 14
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
Analyse in the frequency domain is performed using the Filter Designer Tool program.
Figure 2447. Frequency characteristic of the resulting filter
Figure 2447 illustrates the frequency characteristic of the resulting filter. The figure is obtained in the Filter Designer Tool program. As seen, the resulting filter doesn’t satisfy the required specifications. The attenuation at the frequency of 1500KHz amounts to 26.24dB only, which is not sufficient. The previous value (Nf=16) represents the minimum FIR filter order that satisfies the given specifications.
The filter order is Nf=16, whereas impulse response of the resulting filter is as follows:
Filter realization:
Figure 2448 illustrates the direct realization of designed FIR filter, whereas figure 2449 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2448. FIR filter direct realization
Figure 2449. FIR filter optimized realization structure
2.4.6.3 Example 3
Step 1:
Type of filter – bandpass filter
Filte specifications:

 Sampling frequency – fs=44100Hz; and

 Passband cutoff frequency – fc1=4KHz, fc2=15025Hz.
Step 2:
Method – filter design using Bohman window
Step 3:
Filter order is predetermined, Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13; and
Coefficients have indices between 0 and 12.
Step 4:
The coefficients of Bohman window are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequencies ωc1 and ωc2 can be calculated using expressions:
The values of coefficients (rounded to six digits) are obtained by combining the values of M, ωc1 and ωc2 with expression for the impulse response coefficients of the ideal bandpass filter:
Step 6:
The coefficients of designed FIR filter are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 12
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2450 illustrates the direct realization of designed FIR filter, whereas figure 2451 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2450. FIR filter direct realization
Figure 2451. FIR filter optimized realization structure
2.4.6.4 Example 4
Step 1:
Type of filter – bandstop filter
Filte specifications:

 Sampling frequency – fs=16000Hz; and

 Passband cutoff frequency – fc1=2KHz, fc2=6KHz.
Step 2:
Method – filter design using Bohman window
Step 3:
Filter order is predetermined, Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13; and
Coefficients have indices between 0 and 12.
Step 4:
The coefficients of Bohman window are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequencies ωc1 and ωc2 can be calculated using expressions:
The values of coefficients (rounded to six digits) are obtained by combining the values of M, ωc1 and ωc2 with expression for the impulse response coefficients of the ideal bandstop filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 12
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2452 illustrates the direct realization of designed FIR filter, whereas figure 2453 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2452. FIR filter direct realization
Figure 2453. FIR filter optimized realization structure
2.4.7 Filter design using Blackman window
2.4.7.1 Example 1
Step 1:
Type of filter – lowpass filter
Filte specifications:

 Sampling frequency – fs=44100KHz;

 Passband cutoff frequency – fc=15KHz; and

 Attenuation of 0dB at 0Hz – 0dB.
Step 2:
Method –Filter design using Blackman window
Step 3:
Filter order is predetermined, Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13;
Coefficients have indices between 0 and 12.
Step 4:
The coefficients of Blackman window are found via expression:
Step 5:
The ideal lowpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc can be computed using expression:
The values of coefficients are obtained (rounded to six digits) by combining the values of M and ωc with expression for the impulse response coefficients of the ideal lowpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 12
The FIR filter coefficients h[n] rounded to 6 digits are:
The resulting coefficients must be scaled in order to provide attenuation of 0dB at 0Hz. In order to provide attenuation of 0 dB, the following condition must be met:
The sum of the previously obtained coefficients is:
As the sum is greater than one, it is necessary to divide all coefficients of the impulse response by 1.000274. After division, these coefficients have the following values:
The sum of scaled coefficients is equal to 1, which means that attenuation at 0Hz frequency amounts to 0dB. Note that these coefficients cannot be used in designing a FIR filter safe from filtering overflow. In order to prevent a filtering overflow from occuring it is necessary to satisfy the condition below:
The resulting filter doesn’t meet this condition. Negative coefficients in impulse response make that both conditions cannot be met. The sum of apsolute values of coefficients in the resulting filter is:
The sum of coefficients apsolute values before scaling amounts to 1.37001 (1.369636⋅1.000274). After scaling, it is somewhat less, so it is less likely that an overflow occurs. In such cases, possible filtering overflows are not dangerous. Namely, most processors containing hardware multipliers (which is almost necessary for filtering) have registers with extended band. In this case, it is far more important to faithfully transmit a direct signal to a FIR filter output.
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2454 illustrates the direct realization of designed FIR filter, whereas figure 2455 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2454. FIR filter direct realization
Figure 2455. FIR filter optimized realization structure
2.4.7.2 Example 2
Step 1:
Type of filter – highpass filter
Filte specifications:

 Sampling frequency – fs=22050Hz;

 Passband cutoff frequency – fc=4KHz;

 Prevention of possible filtering overflows.
Step 2:
Method –filter design using Blackman window
Step 3:
Filter order is Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13;
Coefficients have indices between 0 and 12.
Step 4:
The coefficients of Blackman window function are found via:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc can be computed using expression:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal highpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 12
The FIR filter coefficients h[n] rounded to 6 digits are:
In order to prevent filtering overflow, the following condition must be met:
The sum of absolute values of the resulting FIR filter coefficients is:
The obtained coefficients must be scaled (divided) by 1.34807. After that, their values are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2456 illustrates the direct realization of designed FIR filter, whereas figure 2457 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2456. FIR filter direct realization
Figure 2457. FIR filter optimized realization structure
2.4.7.3 Example 3
Step 1:
Type of filter – bandpass filter
Filte specifications:

 Sampling frequency – fs=44100Hz;

 Passband cutoff frequency – fc1=4KHz, fc2=15025Hz;

 Prevention of possible filtering overflow.
Step 2:
Method –filter design using Blackman window
Step 3:
Filter order is predetermined, Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13;
Coefficients have indices between 0 and 12.
Step 4:
The coefficients of Blackman window function are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequencies ωc1 and ωc2 can be computed using expressions:
The values of coefficients (rounded to six digits) are obtained by combining the values of M, ωc1 and ωc2 with expression for the impulse response coefficients of the ideal bandpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 12
The FIR filter coefficients h[n] rounded to 6 digits are:
In order to prevent filtering overflows, the following condition must be met:
The sum of absolute values of the resulting FIR filter coefficients is:
The obtained coefficients must be scaled (divided) by 1.102056. After this, their values are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2458 illustrates the direct realization of designed FIR filter, whereas figure 2459 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2458. FIR filter direct realization
Figure 2459. FIR filter optimized realization structure
2.4.7.4 Example 4
Step 1:
Type of filter – bandstop filter
Filte specifications:

 Sampling frequency – fs=16000Hz;

 Passband cutoff frequencies – fc1=2KHz, fc2=6KHz;

 Prevention of possible filtering overflows.
Step 2:
Method – filter design using Blackman window
Step 3:
Filter order is predetermined, Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13;
Coefficients have indices between 0 and 12.
Step 4:
The coefficients of Blackman window are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequencies ωc1 and ωc2 can be computed using expressions:
The values of coefficients (rounded to six digits) are obtained by combining the values of M, ωc1 and ωc2 with expression for the impulse response coefficients of the ideal bandstop filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 12
The FIR filter coefficients h[n] rounded to 6 digits are:
In order to prevent filtering overflows, the following condition must be met:
The sum of absolute values of the resulting FIR filter coefficients is:
The obtained coefficients must be scaled (divided) by 0.90107. After this, their values are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2460 illustrates the direct realization of designed FIR filter, whereas figure 2461 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2460. FIR filter direct realization
Figure 2461. FIR filter optimized realization structure
2.4.8 Filter design using BlackmanHarris window
2.4.8.1 Example 1
Step 1:
Type of filter –lowpass filter
Filte specifications:

 Sampling frequency – fs=44100KHz;

 Passband cutoff frequency – fc=15KHz;

 Attenuation of 0dB at 0Hz.
Step 2:
Method –filter design usng BlackmanHarris window
Step 3:
Filter order is predetermined, Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13; and
Coefficients have indices between 0 and 12.
Step 4:
The coefficients of BlackmanHarris window are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc may be calculated using expression:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal lowpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 12
The FIR filter coefficients h[n] rounded to 6 digits are:
The resulting coefficients must be scaled in order to provide attenuation of 0dB at 0Hz. To provide 0 dB attenuation, the following condition must be met:
The sum of the previously obtained coefficients is:
As the sum is greater than one, it is necessary to divide all the impulse response coefficients by 0.977947. After this, the values of these coefficients are:
The sum of scaled coefficients is equal to 1, which means that attenuation at 0Hz frequency amounts to 0dB. Note that these coefficients cannot be used in designing a FIR filter safe from filtering overflow. In order to prevent a filtering overflow from occuring it is necessary to satisfy the condition below:
The resulting filter doesn’t meet this condition. Negative coefficients in impulse response indicate that both conditions cannot be met. The sum of apsolute values of coefficients in the resulting filter is:
The sum of coefficients apsolute values before scaling amounts to 1.37001 (1.369636⋅1.000274). After scaling, the sum of coefficients apsolute values is somewhat less, so it is less possible that an overflow occurs. In such cases, possible filtering overflows are not dangerous. Namely, most processors containing hardware multipliers (which is almost necessary for filtering) have registers with extended band. In this case, it is far more important to faithfully transmit a direct signal to a FIR filter output.
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2462 illustrates the direct realization of designed FIR filter, whereas figure 2463 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2462. FIR filter
Figure 2463. Optimized FIR filter design
2.4.8.2 Example 2
Step 1:
Type of filter – highpass filter
Filte specifications:

 Sampling frequency – fs=22050Hz;

 Passband cutoff frequency – fc=4KHz;

 Prevention of filtering overflows.
Step 2:
Method – filter design using BlackmanHarris window
Step 3:
Filter order is Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13; and
Coefficients have indices between 0 and 12.
Step 4:
The coefficients of BlackmanHarris window are found via:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequency ωc can be computed using expression:
The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with the expression for the impulse response coefficients of the ideal highpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 12
The FIR filter coefficients h[n] rounded to 6 digits are:
In order to prevent filtering overflow, the following condition must be met:
The sum of absolute values of the resulting FIR filter coefficients is:
The obtained coefficients must be scaled (divided) by 1.397791. After this, their values are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2464 illustrates the direct realization of designed FIR filter, whereas figure 2465 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2464. FIR filter direct realization
Figure 2465. Optimized FIR filter design
2.4.8.3 Example 3
Step 1:
Type of filter –bandpass filter
Filter specification:

 Sampling frequency – fs=44100Hz;

 Passband cutoff frequencies – fc1=4KHz, fc2=15025Hz; and

 Prevention of possible filtering overflows.
Step 2:
Method – filter design using BlackmanHarris window
Step 3:
Filter order is predetermined, Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13; and
Coefficients have indices between 0 and 12.
Step 4:
The coefficients of BlackmanHarris window are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequencies ωc1 and ωc2 can be computed using expressions:
The values of coefficients (rounded to six digits) are obtained by combining the values of M, ωc1 and ωc2 with expression for the impulse response coefficients of the ideal bandpass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 12
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter reaization:
Figure 2466 illustrates the direct realization of designed FIR filter, whereas figure 2467 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
Figure 2466. FIR filter direct realization
Figure 2467. Optimized FIR filter design
2.4.8.4 Example 4
Step 1:
Type of filter – bandstop filter
Filter specification:

 Sampling frequency – fs=16000Hz;

 Passband cutoff frequency – fc1=2KHz, fc2=6KHz; and

 Prevention of possible filtering overflows.
Step 2:
Method – filter design using BlackmanHarris window
Step 3:
Filter order is predetermined, Nf=20;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=21; and
Coefficients have indices between 0 and 20.
Step 4:
The coefficients of BlackmanHarris window are found via expression:
Step 5:
The ideal highpass filter coefficients (ideal filter impulse response) are expressed as:
where M is the index of middle coefficient.
Normalized cutoff frequencies ωc1 and ωc2 can be computed using expressions:
The values of coefficients (rounded to six digits) are obtained by combining the values of M, ωc1 and ωc2 with expression for the impulse response coefficients of the ideal bandstop filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 ≤ n ≤ 20
The FIR filter coefficients h[n] rounded to 6 digits are:
In order to prevent filtering overflows, the following condition must be met:
The sum of absolute values of the resulting FIR filter coefficients is:
The obtained coefficients must be scaled (divided) by 1.12232. After this, their values are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2468 illustrates the direct realization of designed FIR filter, whereas figure 2469 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are, for the sake of linear phase characteristic, symmetric about their middle element.
This FIR filter is an excellent example showing the importance of the sampling frequency. It is specified to give the passband amounting to 0.5π. This causes most impulse response coefficients of the resulting FIR filter to be zeros. It further makes the filter realization structure simpler. As for optimized FIR filter design, there are only 4 multiplications, even though the filter is of 20th order. Unfortunatelly, the buffer length cannot be minimized. It is fixed and corresponds to the filter order. However, it is possible to affect design complexity, whether it is hardware or software implementation.
Figure 2468. FIR filter direct realization
Figure 2469. Optimized FIR filter design