You are on page 1of 10

International Journal of Electronics and Computer Science Engineering Available Online at

74

www.ijecse.org

ISSN-2277-1956

MATLAB Based Digital IIR Filter Design esign


Samarjeet Singh 1, Uma Sharma 2
12

Department of Electronics & Communication Engineering BBDIT, Ghaziabad. 1 samarbnd@gmail.com 2 Umasharma107@yahoo.com

Abstract a fundamental aspect of signal processing is filtering. Filtering involves the manipulation of the spectrum of a signal by passing or blocking certain portions of the spectrum, depending on the frequency of those portions. In this paper, Digital filters are designed using frequency specifications. Matlab provides different options for digital filter design, which includes function, calls to filter algorithms and a graphical user interface called Sptool. A variety of filter design algorithms are available in Matlab for both IIR and FIR filters. This paper discusses the different options in Matlab to design digital IIR filter. Four types of IIR filters are studied, Butterworth, Chebyshev I, Chebyshev II and Elliptic. Results obtained are plots of magnitude response, phase response, impulse response and pole zero plot for each response, poletype of filter. Results show that the graphical user interface Sptool is a quicker and simpler option than the option of making function calls to the filter algorithms. Results are also compared with the standard filter design tool i.e. FDA tool compared of MATLAB.

I INTRODUCTION Digital filtering is one of the most powerful tools of DSP since DSP applications are primarily algorithm that are ince implemented on DSP processor or in software. In both the cases a fair amount of programming is required. Using interactive software, such as MATLAB, it is now possible to place more emphasis on learning new and difficult concepts than on programming algorithms. Interesting practical examples can be discussed, and useful problems can a be explored. MATLAB is a high performance language for technical computing. It integrates Computation, Visualization and programming in an easy to use environment. Digital IIR filters have been derived from their analog counterparts. Classical prototype analog filters are Butterworth, Chebyshev I, Chebyshev II and Elliptic. Parameters required designing IIR filters are sampling frequency, Pass band edge frequency, Stop band edge frequency, Pass band ripples and Stop band ripples. Using these parameters, magnitude response, phase response, g impulse response and order of the filter can be generated. II CLASSICAL IIR FILTERS Basic prototype IIR filters are of four types. First is Butterworth filter, whose magnitude response is maximally flat from = 0 to = . at = 1. Second filter is Chebyshev filter. This filter itself is of two types, Chebyshev I and Chebyshev II. The Chebyshev Type I filter minimizes the absolute difference between the ideal and actual frequency response over the entire pass band by incorporating an equal ripple of Rp dB in the pass band. Stop band response is maximally flat. The transition from pass band to stop band is more rapid than for the Butterworth filter. at . The Chebyshev Type II filter minimizes the absolute difference between the ideal and actual frequency response over the entire stop band by incorporating an equal ripple of Rs dB in the stop band. Pass band response is maximally flat. Elliptic filters are equiripple in both the pass band and stop band. are They generally meet filter requirements with the lowest order of any supported filter type. Given a filter order n, pass band ripple Rp in decibels, and stop band ripple Rs in decibels, elliptic filters minimize transition width. min at 3, and 4 respectively. . Magnitude response of these classical IIR filters is shown in following figures1, 2,

ISSN- 2277-1956/V1N1-74-83

MATLAB Based Digital IIR Filter Design

Figure 1 Magnitude response of Butterworth filter

III GUI Graphical User Interface is a type of user interface item that allows the user to interact with programs in more ways than typing. The term GUI is historically restricted to the scope of two dimensional display screens with display two-dimensional resolutions capable of describing generic information. Designing the visual composition and temporal behavior of GUI is an important part of software application programming. Its goal is to enhance the efficiency and ease of use ramming. for the logical

Figure 2 Magnitude response of Chebyshev I filter

ISSN- 2277-1956/V1N1-74-83

IJECSE,Volume1,Number 1 Samarjeet Singh and Uma Sharma

76

Figure 3 Magnitude response of Chebyshev II filter

Figure 4 Magnitude response of Elliptic filter

Design of a stored program, a design discipline known as usability. GUI for IIR filters is shown in figure 5in , . which three types of boxes are used. One is text box in which specifications for the filter are specified. Second one is es edit box in which specifications are filled to design a particular filter. Third is pushbutton type boxes in which name of the filter is written. Pushbutton boxes are connected to the code through callback function. button

ISSN- 2277-1956/V1N1-74-83

MATLAB Based Digital IIR Filter Design

Figure 5 GUI panel for filter design

IV SPECIFICATIONS First is sampling frequency which defines the number of samples per second (or per other unit) taken from a continuous signal to make a discrete signal. Second is pass band edge frequency i.et he range of frequencies that can be passed through a filter with negligible attenuation. Third is stop band edge frequency which is the range of frequencies that cannot be passed through a filter. Fourth are passing band ripples i. e .the fluctuations or variations in the frequency magnitude response within the pass band of the filter. Fifth specification is stop band ripples which are the fluctuations or variations in the frequency magnitude response within the stop band of the filter. Ripples are always measured in db and frequency specifications are normally in Hz. But before applying these specifications to the MATLAB code, these are normalized. Normalization as such an operation to make the function being measured dimensionless. Say if we want to compare the spectrums of 2 (or) more signals and let each differ in their sampling frequency , by normalizing they are made to be on the same X-scale and now comparison could be made meaningful because parameters which differ among the signals, are eliminated. Normalization is done within the code itself.

V FDATool The Filter Design and Analysis Tool (FDATool) is a powerful user interface for designing and analyzing filters quickly. FDATool enables you to design digital FIR or IIR filters by setting filter specifications, by importing filters from your MATLAB workspace, or by adding, moving or deleting poles and zeros. FDATool also provides tools for analyzing filters, such as magnitude and phase response and pole-zero plots. FDA tool is an inbuilt standard tool in MATLAB. Results obtained from general GUI are compared with the results from FDA tool. VI RESULTS Results are derived for Butterworth filter from GUI and FDA. Magnitude response, Phase response, Impulse response and Pole-zero plots are obtained. On comparing, we see that the results obtained are the same from both the tools. Specifications taken for the designing low pass Butterworth IIR filter are: Sampling frequency = 1500Hz Pass band edge frequency= 200Hz Stop band edge frequency= 300Hz Pass band ripples= 15db

ISSN- 2277-1956/V1N1-74-83

IJECSE,Volume1,Number 1 Samarjeet Singh and Uma Sharma

78

Stop band ripples= 20db

A. Results from GUI:

Figure 6 Pole-zero plot

Figure 7 Impulse response

ISSN- 2277-1956/V1N1-74-83

MATLAB Based Digital IIR Filter Design

Figure 8 Phase response

Figure 9 Magnitude response

B. Results from FDA:

ISSN- 2277-1956/V1N1-74-83

IJECSE,Volume1,Number 1 Samarjeet Singh and Uma Sharma

80

Figure 10 Pole-zero plot

Figure 11 Impulse response

ISSN- 2277-1956/V1N1-74-83

MATLAB Based Digital IIR Filter Design

Figure 12 Phase response

Figure 13 Magnitude response

From the pole zero plot, the order of the filter can be determined; which is two in this case. Every plot obtained from GUI is the same as that obtained from FDAtool. Values of the filter coefficients can also be calculated from these tools. Values of coefficients from both tools are listed in the table I. From the table, it can be seen that number of coefficients are the same for each tool but values of the feed forward coefficient obtained from GUI are different from those obtained using FDA tool.

ISSN- 2277-1956/V1N1-74-83

IJECSE,Volume1,Number 1 Samarjeet Singh and Uma Sharma

82

S.No.

1. 2. 3.

Table 1 Calculated Coefficient GUI FDA Feedforward Feedback Feedforward Feedback coeff. coeff. coeff. coeff. 0.0385 1.0000 1 1 0.0770 0.0385 -1.3736 0.5275 2 1 -1.3735928 0.52750274

VII CONCLUSION Although many packages exist for digital filter design, the package here presented is different in that the computational engine that designs the filters is the Signals toolbox available in MATLAB. This precludes the designing of IIR filters using Graphical User Interface. Thus by clicking a single button we can have the plots of magnitude response, phase response & pole-zero plot of an IIR filter. Also we can calculate the values of co-efficient of the filter. Results obtained are match well with those obtained using FDA tool with an advantage of user friendliness and thus, obviating tedious process of writing lengthy programmes requiring special skill. Any logic can be implemented in GUI. VIII- REFERENCES [1] Huelsman, L. P., Active and Passive Analog Filter Design; Mc Graw Hill, 1993. [2] MATLAB The Language of Technical Computing, The Math Works Inc., Natick, MA., 1997. [3] Alcntara, R., MFILTERS Design of analog and digital filters, Masters thesis, (in Spanish), Universidad de las Amricas, Puebla, 2000. [4] Escalante, T., Passive and active filter realizations in MFILTERS 2.0, B.S. thesis, (in Spanish), Universidad de las Amricas, Puebla, 2000. [5] Romero, J. J., MFILTERS 2.0 FIR filter design using Remez algorithm, B.S. thesis, (in Spanish), Universidad de las Amricas, Puebla, 2000. [6] Alfonso Fernandez-Vazquez Gordana Jovanovic- Dolecek, IIR filter design based on compex Allpass filters, Mexico. [7] Chien-Chang Tseng, senior member IEEE and Soo-Chang, Stable IIR Notch Filter Design with Optimal Pole Placement, 2001 [8] Ivan W. Selesnick and C. Sidney Burrus, Generalized Digital Butterworth Filter Design, December, 1997. [9] Timothy J. . Schlichter, Digital Filter Design Using Matlab [10] Jung Doo Jungi and Seong G. Kong, Design of Optimal Digital IIR Filters using the Genetic Algorithm, 1996. [11] A. V. Oppenheim and R. W. Schafer, Discrete-Time Signal Processing, Prentice Hall, 1989. [12] D. E. Goldberg. Genetic Algorithms in Search, Optimization, and Machine Learning, Addison Wesley, 1989. [13] Z. Michalewicz, Genetic Algorithms + Data Structures = Evolutionary Programs, Springer-Verlag: Berlin, Heidelberg, 1994. [14] D. M. Etter, M. J. Hicks, and K. H. Cho, Recursive Adaptive Filter Design using an Adaptive Genetic Algorithm, Proc. of IEEE Int. Conf. on ASSP, pp.635-638, 1982.

ISSN- 2277-1956/V1N1-74-83

MATLAB Based Digital IIR Filter Design

15] R. Nambiar, C. K. Tang, and P. Mars, "Genetic and learning automata algorithms for adaptive digital filters," Proc. IEEE Int. Conf. ASSP, Vol. IV, pp.41-44, 1992. [16] S. J. Flockton and M. S. White, Pole-zero identification using genetic algorithms, Proc. 5th Int. Conf. on Genetic Algorithms, pp.531-535, 1993. [17] K. S. Tang, K. F. Man, S. Kwong, and Q. He, Genetic Algorithms and their Applications, IEEE Signal Processing Magazine, pp.22-37, 1996. [18] K. S. Tang, K. F. Man, S. Kwong, and Z. F. Liu, Design and Optimization of IIR Filter Structure Using Hierarchical Genetic Algorithms, IEEE Trans. on Industrial Electronics, Vol. 45, No. 3, pp.481-487, 1998. [19] T. P. Krauss, L. Shure, and J. N. Little, MATLAB Signal Processing Toolbox, Mathworks Inc., 1994.

ISSN- 2277-1956/V1N1-74-83