FIR Filter Design Implementation To fully design and

  • Slides: 14
Download presentation
FIR Filter Design & Implementation • To fully design and implement a filter five

FIR Filter Design & Implementation • To fully design and implement a filter five steps are required: (1) Filter specification (2) Coefficient calculation (3) Structure selection (4) Simulation (optional) (5) Implementation

Software Tools for Designing Filter • MATLAB provides some advanced tools for filters design

Software Tools for Designing Filter • MATLAB provides some advanced tools for filters design – Signal Processing Tool (SPTool) – Filter Design (FDATool) • There also some free software packages to design filters • Our main problem is how to implement the filter given the coefficients • So we will design FIR filters using the relatively simple method of Windowing -- write Matlab scripts

Lowpass Filter Specification

Lowpass Filter Specification

Window Method : Step 1 • First stage of this method is to calculate

Window Method : Step 1 • First stage of this method is to calculate the coefficients of the ideal filter. • This is calculated as follows:

Window Method : Step 2 • Second stage of this method is to select

Window Method : Step 2 • Second stage of this method is to select a window function based on the passband or attenuation specifications, then determine the filter length based on the required width of the transition band Window Type Normalized Transition Width Passband Ripple (d. B) Stopband Attenuation (d. B) Rectangular 0. 9/N 0. 7416 21 Hanning 3. 1/N 0. 0546 44 Hamming 3. 3/N 0. 0194 53 Blackman 5. 5/N 0. 0017 74

Window Method : Step 2 • The normalized transition bandwidth as listed in the

Window Method : Step 2 • The normalized transition bandwidth as listed in the table is defined as • Example: If we choose the Hamming window, and specify a transition band from 6 k. Hz to 7 k. Hz, with sampling frequency at 40 k. Hz, then the filter order is calculated as

Window Method : Step 3 • The third stage is to calculate the set

Window Method : Step 3 • The third stage is to calculate the set of truncated or windowed impulse response coefficients, h[n]: for

Using Matlab's fir 1() • Instead of doing the design start from the ideal

Using Matlab's fir 1() • Instead of doing the design start from the ideal reponse, we shall use Matlab's fir 1() function • We will design a FIR filter with the following specification – – sampling frequency = 8000 passband edge frequency = 1200 stopband edge frequency = 1800 minimum stopband attenuation = 40 d. B • By using the Hamming window, the stopband attenuation specification is met • By default, fir 1() uses the Hamming window • For more information, please refer to the Matlab on-line help

Using Matlab's fir 1() fsamp = 8000; fp = 1200; % passband fs =

Using Matlab's fir 1() fsamp = 8000; fp = 1200; % passband fs = 1800; % stopband fc = (fp+fs)/2; % cutoff % default using Hamming window, compute order N = round(3. 3*fsamp/(fs-fp)); str=sprintf('Filter order = %d', N); disp(str); wc = 2*fc/fsamp; b=fir 1(N, wc); % normalize to pi radian filtdesign. m freqz(b, 1, 512, fsamp);

FIR Filter Structure - Direct Form

FIR Filter Structure - Direct Form

Linear Phase FIR • For linear phase FIR, such as those designed with the

Linear Phase FIR • For linear phase FIR, such as those designed with the window method, the coefficients have to be symmetrical • We can then make use of the symmetry to reduce the multiplications

Example of Symmetrical FIR - Even Length

Example of Symmetrical FIR - Even Length

Example of Symmetrical FIR - Odd Length

Example of Symmetrical FIR - Odd Length

FIR Filters Design with FDATool • The Filter Design and Analysis Tool (FDATool) is

FIR Filters Design with FDATool • The Filter Design and Analysis Tool (FDATool) is a graphical user interface (GUI) for designing, quantizing, and analyzing digital filters. • It includes a number of advanced filter design techniques and supports all the filter design methods in the Signal Processing Toolbox. – – designing filters by setting filter specifications; analyzing designed filters; converting filters to different structures; and quantizing and analyzing quantized filters. • Open the FDATool by typing "fdatool" at the. MATLAB command window.