




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 电光源材料与工艺考核试卷
- 电气设备防爆装置制造考核试卷
- 物联网数据标准化与互操作性考核试卷
- 户外设施使用协议
- 海底隧道施工质量控制与验收考核试卷
- 漆器制作与工匠技艺比赛的组织考核试卷
- 经济型酒店品牌服务质量评价体系考核试卷
- 小学生寒假防溺水安全教育
- 电池微型化与集成技术考核试卷
- 磷酸铁锂电池制造的新发展考核试卷
- 2024华能四川能源开发有限公司下属单位招聘笔试参考题库附带答案详解
- 钢结构高处作业安全管理
- JJF 2221-2025导热系数瞬态测定仪校准规范
- 华为手机协议合同
- 甘肃省陇南市礼县第六中学2024-2025学年八年级下学期第一次月考数学试卷(无答案)
- 公司两班倒管理制度
- 完整版高中古诗文必背72篇【原文+注音+翻译】
- 2025年武汉数学四调试题及答案
- 人教版小学四年级语文下册2024-2025学年度第二学期期中质量检测试卷
- 七年级下册道德与法治(2025年春)教材变化详细解读
- 鸡头黄精栽培技术规程
评论
0/150
提交评论