




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
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 desi
22、gns. The only change isin the filter 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 ma
23、gnitude and phase responses of 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 co
24、efficients. For this example, theChebyshev 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 constr
25、aints, the elliptic filter designalgorithm 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 rip
26、ple(monotonic). The elliptic and 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
27、 phase response that is more nonlinear 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
28、 theelliptic filter.Highpass andBandpass 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 filt
29、er order isfound using the function 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 100H
30、z transition band.% Highpass Chebyshev 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 = fre
31、qz_m(b,a);plot(w*8000/2/pi,db);axis(800 1200 -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 w
32、s) are two-element vectors sincethere are 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 =
33、0.5; %Passband ripple in dBAs = 20; %Stopband 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
34、Filter');The following figure shows the magnitude response of the bandpass 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
35、 a graphical user interface capable ofanalyzing and manipulating signals, 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 w
36、indow)and IIR filters (Butterworth, Chebyshev type 1 and 2, elliptic). The 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
37、for a lowpass filter design using thespecifications given above. The Chebyshev 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 spec
38、trum contained in the first screenshot.Future DirectionsDigital filters 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
39、allows the user to viewthe magnitude response of the filter, not the phase 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
40、 output of the filter coefficients. With the Matlab code given above, thefilter 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,multi
41、pliers, and delay elements. The filter coefficients are used as the gain 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.Referen
42、ces Hanselman, Duane, and Littlefield, Bruce. Mastering Matlab 5. Prentice 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 River, NJ,1996. Ziemer,
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 法學(xué)概論互動(dòng)學(xué)習(xí)的試題及答案經(jīng)驗(yàn)
- 數(shù)字營銷與社交平臺(tái)技術(shù)試題及答案
- 代碼優(yōu)化與重構(gòu)考試試題及答案
- 廣東省廣州市名校2025屆七年級(jí)數(shù)學(xué)第二學(xué)期期末調(diào)研試題含解析
- 解鎖2025年軟件設(shè)計(jì)師試題及答案
- 2025年軟考軟件設(shè)計(jì)師備考秘籍試題及答案
- 上海市行業(yè)協(xié)會(huì)商會(huì)評(píng)估指標(biāo)(2025年版)
- 美術(shù)教學(xué)中的團(tuán)隊(duì)合作培養(yǎng)計(jì)劃
- 企業(yè)責(zé)任擔(dān)當(dāng)?shù)目偨Y(jié)與反思計(jì)劃
- 制定多元化業(yè)務(wù)拓展計(jì)劃降低風(fēng)險(xiǎn)
- 《注冊(cè)建造師執(zhí)業(yè)工程規(guī)模標(biāo)準(zhǔn)》
- 公立醫(yī)療機(jī)構(gòu)特需醫(yī)療服務(wù)管理暫行辦法
- 社會(huì)心理學(xué)第六講愛情課件
- 河北省秦皇島市市藥品零售藥店企業(yè)藥房名單目錄
- 緊急填倉換刀及破除孤石技術(shù)
- 南瑞科技220kv斷路器輔助保護(hù)nsr-322an型保護(hù)裝置調(diào)試手冊(cè)
- 滾筒冷渣機(jī)技術(shù)協(xié)議
- 氨基轉(zhuǎn)移酶檢測臨床意義和評(píng)價(jià)注意點(diǎn)
- 中債收益率曲線和中債估值編制方法及使用說明
- 國家開放大學(xué)《行政組織學(xué)》章節(jié)測試參考答案
- 什么是標(biāo)準(zhǔn)工時(shí)如何得到標(biāo)準(zhǔn)工時(shí)
評(píng)論
0/150
提交評(píng)論