数字滤波器设计英文文献.doc

上传人:小飞机 文档编号:4033769 上传时间:2023-04-01 格式:DOC 页数:11 大小:513.50KB
返回 下载 相关 举报
数字滤波器设计英文文献.doc_第1页
第1页 / 共11页
数字滤波器设计英文文献.doc_第2页
第2页 / 共11页
数字滤波器设计英文文献.doc_第3页
第3页 / 共11页
数字滤波器设计英文文献.doc_第4页
第4页 / 共11页
数字滤波器设计英文文献.doc_第5页
第5页 / 共11页
点击查看更多>>
资源描述

《数字滤波器设计英文文献.doc》由会员分享,可在线阅读,更多相关《数字滤波器设计英文文献.doc(11页珍藏版)》请在三一办公上搜索。

1、Digital Filter Design Using MatlabBy Timothy J. SchlichterEE 4000 Introduction to Digital Filtering5/2/99Submitted to: Dr. Joseph PiconeMississippi State UniversityDepartment of Electrical and Computer EngineeringEXECUTIVE SUMMARYA fundamental aspect of signal processing is filtering. Filtering invo

2、lves the manipulationof the spectrum of a signal by passing or blocking certain portions of the spectrum,depending on the frequency of those portions. Filters are designed according to what kindof manipulation of the signal is required for a particular application. Digital filters areimplemented usi

3、ng three fundamental building blocks: an adder, a multiplier, and a delayelement.The design process of a digital filter is long and tedious if done by hand. With the aid ofcomputer programs performing filter design algorithms, designing and optimizing filterscan be done relatively quickly. This pape

4、r discusses the use of Matlab, a mathematicalsoftware package, to design, manipulate, and analyze digital filters.The design options in Matlab allow the user to either create a code for designing filtersthat calls built-in functions, or to design filters in Sptool, a graphical user interface. Eachof

5、 these methods are examined in this paper. The strengths and weaknesses of each aredetailed in the following discussion.This paper concludes with a discussion of how the data given by Matlab for various filterscan be used to implement filters on real digital signal processors. Matlab provides all th

6、einformation necessary for building a hardware replica of the filter designed in software.TABLE OF CONTENTS1. Abstract.42. Introduction. .43. Lowpass Filter Design74. Highpass and Bandpass Filter Design115. Sptool.136. Future Directions167. Acknowledgments.168. References.169. Appendix.17AbstractMat

7、lab provides different options for digital filter design, which include function calls tofilter algorithms and a graphical user interface called Sptool. A variety of filter designalgorithms are available in Matlab for both IIR and FIR filters. This paper discusses thedifferent options in Matlab and

8、gives examples of lowpass, highpass, and bandpass filterdesigns.Results show that the graphical user interface Sptool is a quicker and simpler option thanthe option of making function calls to the filter algorithms. Sptool has a more user-friendly environment since the spectrum of the filter is imme

9、diately displayed to the user,and the user can quickly zoom in and examine particular areas of interest in the spectrum(i.e. the passband). However, the shortcoming of Sptool is that it only displays themagnitude response of the filter, not the phase response.IntroductionA key element in processing

10、digital signals is the filter. Filters perform directmanipulations on the spectra of signals. To completely describe digital filters, three basicelements (or building blocks) are needed: an adder, a multiplier, and a delay element. Theadder has two inputs and one output, and it simply adds the two i

11、nputs together. Themultiplier is a gain element, and it multiplies the input signal by a constant. The delayelement delays the incoming signal by one sample. Digital filters can be implementedusing either a block diagram or a signal flow graph. Figure 1 shows the three basicelements in block diagram

12、 form, and Figure 2 shows them in signal flow graph form.With the basic building blocks at hand, the two different filter structures can easily beimplemented. These two structures are Infinite Impulse Response (IIR) and FiniteImpulse Response (FIR), depending on the form of the systems response to a

13、 unit pulseinput. IIR filters are commonly implemented using a feedback (recursive) structure, whileFIR filters usually require no feedback (non-recursive).In the design of IIR filters, a commonly used approach is called the bilineartransformation. This design begins with the transfer function of an

14、 analog filter, thenperforms a mapping from the s-domain to the z-domain. Using differential equations, itcan be shown (Proakis 677) that the mapping from the s-plane to the z-plane isThis mapping results in a general form for an IIR filter with an arbitrary number of polesand zeros. The system resp

15、onse and the difference equation for this filter is as follows:This system response can be easily realized using a signal flow graphAn FIR filter has a difference equation ofBy taking the z-transform, the system response isThe realization of an FIR filter using a signal flow graph is straightforward

16、.Matlab has several design algorithms that can be used to create and analyze both IIR andFIR digital filters. The IIR filters that can be created in Matlab are Butterworth,Chebyshev type 1 and 2, and elliptic. The FIR filter algorithms in Matlab are equiripple,least squares, and Kaiser window. The M

17、atlab code required to implement these filtersinvolves bilinear transformations and function calls to analog prototype filters. Thefollowing sections give examples of Matlab implementation of the IIR filters listed above.Lowpass Filter DesignUsing Matlab, a lowpass digital filter is designed using v

18、arious analog prototypes:Chebyshev, Butterworth, and Elliptic. The optimum filter type is chosen on the basis ofimplementation complexity, magnitude response, and phase response. The designspecifications for the filter are as follows: Cutoff frequency = 1000Hz Sample frequency = 8000Hz Passband ripp

19、le = 0.5dB Stopband attn. = 60dB Transition band = 100HzMatlab Code (Chebyshev):% Lowpass digital filter with Chebyshev-I analog prototype% Digital Filter Specifications:wp = 0.125*2*pi; % digital passband frequency in Hz (normalized)ws = 0.1375*2*pi; % digital stopband frequency in Hz (normalized)R

20、p = 0.5; % passband ripple in dBAs = 20; % stopband attenuation in dB% Analog Prototype Specifications:Fs = 1; T = 1/Fs;OmegaP = (2/T)*tan(wp/2); % prewarp prototype passband frequencyOmegaS = (2/T)*tan(ws/2); % prewarp prototype stopband frequency% Analog Chebyshev-1 Prototype Filter Calculation:c,

21、 d = chb1(OmegaP, OmegaS, Rp, As);% Bilinear Transformation:b, a = bilinear(cs, ds, Fs);%db,mag,pha,grd,w = freqz(b,a);plot(w*8000/2/pi,db);xlabel(frequency (Hz); ylabel(decibels); title(Magnitude indB);This exact code is also used for the elliptic and Butterworth designs. The only change isin the f

22、ilter calculations of each type. Instead of calling chb1(), the elliptic filter designcalls a function “elliptic()” and the Butterworth design calls a function“butterworth()”. See the appendix for the Matlab code of the function chb1().The following figures show the magnitude and phase responses of

23、each type of filter.Magnitude Response of Chebyshev FilterPhase of Chebyshev FilterMagnitude Response of Elliptic FilterPhase of Elliptic FilterMagnitude Response of Butterworth FilterPhase of Butterworth FilterThe Matlab code outputs the filter order and the filter coefficients. For this example, t

24、heChebyshev filter order was nine. The elliptic filter had an order of five, and theButterworth filter order was thirty-two.Several conclusions can be drawn about these low-pass filter designs from this simpleexample. First, in general, for a given set of design constraints, the elliptic filter desi

25、gnalgorithm will result in the simplest filter (in terms of complexity). The most complexfilter is the Butterworth filter with an order of thirty-two. In terms of passband ripple, theButterworth filter gives the optimum response. In the passband, there is almost no ripple(monotonic). The elliptic an

26、d Chebyshev filters both have much more ripple in thepassband. So, there is a tradeoff between these three different types of filters. In terms ofmagnitude response and complexity, the elliptic ripple is most likely the optimum choice.However, the elliptic ripple has a phase response that is more no

27、nlinear than theChebyshev and Butterworth filters. Therefore, if a sharp cutoff and relatively lowcomplexity is required, the choice would be the elliptic filter. If the phase response wouldneed to be more linear, a Chebyshev or Butterworth filter should be chosen over theelliptic filter.Highpass an

28、dBandpass Filter DesignMatlab provides functions for implementing lowpass-to-highpass and lowpass-to-bandpassconversions. By providing a filter order, the passband ripple, and the 3dB cutofffrequency to the function cheby1(), a highpass filter can be designed. The filter order isfound using the func

29、tion chebord(). For a Butterworth prototype, the functions arebutter() and buttord(). For the elliptic prototype, the functions are ellip() andellipord().The following Matlab code is used to design a Chebyshev highpass digital filter with apassband at 1100Hz and a 100Hz transition band.% Highpass Ch

30、ebyshev Digital Filterws = 0.125*2*pi; % digital stopband frequency in rad/swp = 0.1375*2*pi; % digital passband frequency in rad/sRp = 0.5; % passband ripple in dBAs = 20;N,wn = cheb1ord(wp/pi,ws/pi,Rp,As);b,a = cheby1(N, Rp, wn, high);db,mag,pha,grd,w = freqz_m(b,a);plot(w*8000/2/pi,db);axis(800 1

31、200 -22 1);The following figure shows the magnitude response of the highpass filter.Magnitude Response of Chebyshev FilterBandpass filters are found using these same two functions. However, with bandpassfilters, the passband and stopband frequencies (wp and ws) are two-element vectors sincethere are

32、 two passband frequencies and two stopband frequencies. The Matlab codebelow shows the design of an elliptic digital bandpass filter.% Bandpass Elliptic Digital Filterws = 0.3*pi 0.75*pi %Stopband edge frequencywp = 0.4*pi 0.6*pi %Passband edge frequencyRp = 0.5; %Passband ripple in dBAs = 20; %Stop

33、band attenuation in dBN,wn = ellipord(wp/pi,ws/pi,Rp,As);b,a = ellip(N,Rp,As,wn);db,mag,pha,grd,w = freqz_m(b,a);plot(w*8000/2/pi,db);axis(500 3500 -22 1);xlabel(frequency (Hz); ylabel(decibels); title(Magnitude Response of Elliptic Filter);The following figure shows the magnitude response of the ba

34、ndpass filter designed in theMatlab code above.Magnitude Response of Elliptic FilterSptoolMatlab has a very useful visualization tool for designing and analyzing digital filters calledSignal Processing Tool, or Sptool. Sptool is a graphical user interface capable ofanalyzing and manipulating signals

35、, filters, and spectra. For filter design, Sptool allowsthe user to select the filter design algorithm to use when creating the filter. The designalgorithms included in Sptool are FIR filters (equiripple, least squares, Kaiser window)and IIR filters (Butterworth, Chebyshev type 1 and 2, elliptic). T

36、he user is also allowed tospecify the type of filter (lowpass, bandpass, highpass, or bandstop). Sptool designs thefilter and displays the magnitude response and the filter order.The figures below show actual Sptool screenshots for a lowpass filter design using thespecifications given above. The Che

37、byshev Type 1 algorithm was used for thesescreenshots. By using the zoom options, different parts of the spectrum can be analyzedquickly and easily with Sptool. The second screenshot is a windowed view of thepassband of the spectrum contained in the first screenshot.Future DirectionsDigital filters

38、can be quickly and easily designed in Matlab using the methods describedabove. Sptool offers a much quicker way of designing and comparing different filters thanusing the function calls to the filter algorithms. However, Sptool allows the user to viewthe magnitude response of the filter, not the pha

39、se response. For some applications, thephase response may be more important than the magnitude response, so in these casesSptool would not be as useful in determining the optimum filter design. Also, Sptool doesnot give a direct output of the filter coefficients. With the Matlab code given above, th

40、efilter coefficient are displayed to the user.The results from Matlab can be used directly to implement the digital filters on real DSPs.These results are all that is needed to draw a complete signal flow graph with adders,multipliers, and delay elements. The filter coefficients are used as the gain

41、 factors for themultipliers, and shift registers are used as the delay elements (for each z-n factor).AcknowledgmentsMany thanks to Dr. Joseph Picone for his guidance, assistance, and time in the executionof this project.References Hanselman, Duane, and Littlefield, Bruce. Mastering Matlab 5. Prenti

42、ce Hall. UpperSaddle River, NJ, 1998. Ingle, Vinay K. and Proakis, John G. Digital Signal Processing Using Matlab. PWSPublishing Company, 1997. Proakis, John G. and Manolakis, Dimitris G. Digital Signal Processing: Principles,Algorithms, and Applications, 3rd Edition. Prentice Hall. Upper Saddle Riv

43、er, NJ,1996. Ziemer, Rodger E., Tranter, William H., and Fannin, D. Ronald. Signals and Systems:Continuous and Discrete, 3rd Edition. Macmillan Publishing Company, 1993.Appendixfunction b,a = chb1(Wp, Ws, Rp, As);% Analog Lowpass Filter Design: Chebyshev-1% b,a = chb1(Wp, Ws, Rp, As);% b = Numerator

44、 coefficients of Ha(s)% a = Denominator coefficients of Ha(s)% Wp = Passband edge frequency in rad/sec% Ws = Stopband edge frequency in rad/sec% Rp = Passband ripple in dB% As = Stopband attenuation in dB%if Wp = 0error(Passband edge must be larger than 0)endif Ws = Wperror(Stopband edge must be lar

45、ger than Passband edge)endif (Rp = 0) | (As 0)error(PB ripple and/or SB attenuation must be larger than 0)endep = sqrt(10(Rp/10)-1);A = 10(As/20);OmegaC = Wp;OmegaR = Ws/ Wp;g = sqrt(A*A-1)/ep;N = ceil(log10(g+sqrt(g*g-1)/log10(OmegaR+sqrt(OmegaR*OmegaR-1);fprintf(n* Chebyshev-1 Filter Order = %2.0f

46、 n,N);b,a = ap_chb1(N, Rp, OmegaC);function b,a = ap_chb1(N, Rp, Omegac);% Chebyshev-1 Analog Lowpass Filter Prototype% b,a = ap_chb1(N, Rp, Omegac);% b = nemerator polynomial coefficients% a = denominator polynomial coefficients% N = Order of the elliptical filter% Rp = Passband Ripple in dB% Omegac = cutoff frequency in rad/sec%z,p,k = cheb1ap(N,Rp);a = real(poly(p);aNn = a(N+1);p = p*Omegac;a = real(poly(p);aNu = a(N+1);k = k*aNu/aNn;b0 = k;B = real(poly(z);b = k*B;

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号