Professional Documents
Culture Documents
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. FDATool seamlessly integrates additional functionality from other MathWorks products as described in the following table. Use FDATOOL in matlab. If you type >>fdatool in command window, FDAtool will be opened. There you can select FIR or IIR filter, order of filter and cutoff frequency of a filter (either HPF, LPF or BPF). That code will automatically generate .m file for you. Record your voice. Analyze the effect of lowpass filtering on speech signal. Use the Filter Design and Analysis Tool (FDATool) of MATLAB for the purpose of designing LPF filter. Consider separately FIR and IIR filter. A detail demo of the FDATool is available in the website of The Mathworks which I recommend you to visit for acquiring more knowledge in Matlab.
http://www.mathworks.com/products/demos/shipping/signal/introfdatooldemo.html?product=SG
http://www.mathworks.com/products/demos/shipping/signal/introfdatooldemo.html?product=SG
Contents
q q q q q q q q q q q q q q
Getting Started Designing a Filter Viewing other Analyses Comparing the Design to Filter Specifications Changing Axes Units Marking Data Points Optimizing the Design Using a Different Filter Structure Changing Analyses Parameters Exporting the Filter Generating an M-File Quantizing a Filter Targets Additional Features
Getting Started
Type fdatool at the MATLAB command prompt: >>fdatool A Tip of the Day dialog displays with suggestions for using FDATool. Then, the GUI diplays with a default filter.
http://www.mathworks.com/products/demos/shipping/signal/introfdatooldemo.html?product=SG
The Current Filter Information region The Filter Display region and The Design panel
The upper half of the GUI displays information on filter specifications and responses for the current filter. The Current Filter Information region, in the upper left, displays filter properties, namely the filter structure, order, number of sections used and whether the filter is stable or not. It also provides access to the Filter manager for working with multiple filters. The Filter Display region, in the upper right, displays various filter responses, such as, magnitude response, group delay and filter coefficients. The lower half of the GUI is the interactive portion of FDATool. The Design Panel, in the lower half is where you define your filter specifications. It controls what is displayed in the other two upper regions. Other panels can be displayed in the lower half by using the sidebar buttons. The tool includes Context-sensitive help. You can right-click or click the What's This? button to get information on the different parts of the tool.
Designing a Filter
We will design a low pass filter that passes all frequencies less than or equal to 20% of the Nyquist frequency (half the sampling frequency) and attenuates frequencies greater than or equal to 50% of the Nyquist frequency. We will use an FIR Equiripple filter with these specifications:
http://www.mathworks.com/products/demos/shipping/signal/introfdatooldemo.html?product=SG
q q q q
Passband attenuation 1 dB Stopband attenuation 80 dB A passband frequency 0.2 [Normalized (0 to 1)] A stopband frequency 0.5 [Normalized (0 to 1)]
1. Select Lowpass from the dropdown menu under Response Type and Equiripple under FIR Design Method. In general, when you change the Response Type or Design Method, the filter parameters and Filter Display region update automatically. 2. Select Specify order in the Filter Order area and enter 30. 3. The FIR Equiripple filter has a Density Factor option which controls the density of the frequency grid. Increasing the value creates a filter which more closely approximates an ideal equiripple filter, but more time is required as the computation increases. Leave this value at 20. 4. Select Normalized (0 to 1) in the Units pull down menu in the Frequency Specifications area. 5. Enter 0.2 for wpass and 0.5 for wstop in the Frequency Specifications area. 6. Wpass and Wstop, in the Magnitude Specifications area are positive weights, one per band, used during optimization in the FIR Equiripple filter. Leave these values at 1. 7. After setting the design specifications, click the Design Filter button at the bottom of the GUI to design the filter. The magnitude response of the filter is displayed in the Filter Analysis area after the coefficients are computed.
http://www.mathworks.com/products/demos/shipping/signal/introfdatooldemo.html?product=SG
Magnitude response Phase response Magnitude and Phase responses Group delay response Phase delay response Impulse response Step response Pole-zero plot Filter Coefficients Filter Information
http://www.mathworks.com/products/demos/shipping/signal/introfdatooldemo.html?product=SG
http://www.mathworks.com/products/demos/shipping/signal/introfdatooldemo.html?product=SG
As you can see in the Current Filter Information area, the filter order decreased from 30 to 16, the number of ripples decreased and the transition width became wider. The passband and the stopband specifications still meet the design criteria.
http://www.mathworks.com/products/demos/shipping/signal/introfdatooldemo.html?product=SG
q q q q
To save the displayed parameters as the default values, click Save as Default. To restore the MATLAB-defined default values, click Restore Original Defaults.
http://www.mathworks.com/products/demos/shipping/signal/introfdatooldemo.html?product=SG
If exporting to the MATLAB workspace, you can export as coefficients or as an object by selecting from the Export from the pulldown menu. If you want to export as an object, the object's properties control many aspects of its apearance and behaviour. You can use GET and SET commands from the MATLAB command prompt to have access and manipulate the property values of the object.
Generating an M-File
FDATool allows you to generate M-code to re-create your filter. This enables you to embed your design into existing code or automate the creation of your filters in a script. Select Generate M-file from the File menu and specify the filename in the Generate M-file dialog box. The following code was generated from the minimum order filter we designed above:
http://www.mathworks.com/products/demos/shipping/signal/introfdatooldemo.html?product=SG
Quantizing a Filter
If you have the Filter Design Toolbox installed, the Set quantization parameters panel is available on the sidebar:
You can use this panel to quantize and analyze double-precision filters. With the Filter Design Toolbox you can quantize from double-precision to single-precision. If you have the Fixed Point Toolbox, you can quantize filters to fixed-point precision. Note that you can not mix floating-point and fixed-point arithmatic in your filter.
Targets
The Targets menu of the FDATool allows you to generate various types of code representing your filter. For example, you can generate C header files, XILINX coefficients(COE) files (with the Filter Design Toolbox) and VHDL, Verilog along with test benches (with Filter Design HDL Coder).
Additional Features
FDATool also integrates additional functionality from these other MathWorks products:
q
Embedded Target for Texas Instruments C6000 DSP- Generates downloadable code for C6000 DSP target board. Filter Design HDL Coder- Generates synthesizable VHDL or Verilog code for fixed-point filters Filter Design Toolbox- Adds advanced FIR and IIR design techniques (i.e. Filter transformations,
http://www.mathworks.com/products/demos/shipping/signal/introfdatooldemo.html?product=SG
Multirate filters) % * *Embedded IDE Link(TM) CC Development Tool*- Exports code % usable by Code Composser Studio % % * *Signal Processing Blockset(TM)*- Generates equivalent Signal Processing Blockset % block for the filter % % * *Simulink(R)*- Generates filters from atomic Simulink blocks %
ee
f 9 w Pduivs G vtsq rvphp GC @Pdrq i@7 p p 9E & 9 rhuC 9 Ps 6 f 9 hwdu C q au h y CIsI A 9 p C q s G uvrsq gtp 9 @b 9 E@vs DCvs T 9 hwdu3u hSCp YsH`CDu Ba x 9b HpE 0V9 W7 p xu DCp s G a GE YsE vHhDCw 9 dvyu C 9 @ Ga @u a h a u q C p s u b qap b E 9A 9 w f 9 hwdiq s G vrsq evs 7 Gp u Cu au h w u 9 h qs c p 9 p IsI 9 p w qa b E 9 v 9 q @7 c 9 @uvrslu C HGG sy UGG Cexxa A u C @7 p p s 7 )pp GC C@PBVq A @7 Uxu DCp s G a GE YsE u UhDCw 9 b x p u C 9 @ Ga @u f GA f I a C u 4huCPs WWV # dVq `9 9 Gb 7 w 9 hwdmu hSCp YsH`SC$vda i@7 Uvvs 9 @86 pus x 9 p y u 97 f A a 9 hpYCq fs G cI C bu u a b a wu 9@7 p 7 hpecyu C 9b Wvs 7 b@vs A a u 9 rpp DCq c 9 I Gb 7 w 9 Pss 9 Ts 7 pdv DCwhFC 9E b W7 p @vu HhYCw 9 id 9 bus b qa f U9G Daq hWu @Ps G ms 9 w f g 9 E@vs DCqvs @vs vs 9 7 hpec U9G Ps DCvs T Cb u T bu S u C I q d@vrsq vs DCVwvBas w C pxa A u C 9 w 7 c q 9 U`SC$vBa x hp@ rq 6y @uda u hHYCw 9 bPs G @7 tp @u YE 9 q 6y bu u ws h pus CI C s I 9 p hC 9 igSU e pqi U e
S i j 4hue a
fh w d@huDCvs 9 Hq 9E ub u d@vs $v(sp du YE 9 w ec u bu pu w C C9E9 A hwC 7 UEC 7 c pp DCvs 9 u C Gu vdrww H9G Ypq 9 s 7 Wrq 7 p G Bu UhDCw @7 p @huDCrww s A I 9 vdew gu hSCp YsH`SC$vda q uu ha s 9 h p ub C pus YfHp@@Rrq A hp@($mu ep G Daw 9 tp Eab CI e s C q w c CI p y G a 9 G dYbq ep @me g cUvsu hSCp YsHEC @A DCp G ( @7 p U9@A s 4V9 q 6y q 9 yp s q 9 xa A YE G (sp Hh@qvs u C @d6y 9 vs xa A u C p C Cb pu bua q p C y 97 T pu w C bua C p C h s s usy w 97 9 p 9 HqDEhw@b v 9 w sE @86 Yfq 9 Vpq 9 u HE t ! r G s 9 Hb uC u du vs 9 HbYCdu gWd6y hwxa A u (P G Bu mvEv 9 vsE @86 f 9 p 9 YqYEw @b 9 I Ips Gc s HGG ec Ia A xP W86 f } w 9 Ga s T v q 9 (du 9 p @u m Gp u u 9 p vdFw 9 Ga vv C w C p pa 97 y I a C s y sTy q 9 (xRu H9G P(s$dH2s Gp u @u Ptsp (9 p 9 YqYEw @b 9 mpl hpq } g @u Su 99 cp 9 q 9 (du G s 9 vs U9@A vs V9 I a I pua E h C z C I s C b s S I I a q pu G q y T aa p s h C h s I s pus y p 97 v6w 9 Ga s y kx@u SC$u HE Pu Wu P(sp z P G Bu s 9 ps)q 9 U`SC$vBa x s v)xa A huC @86 Hfw 9 Ga s 2q 9 9c Pu T y u p pa u p bu s pus u 9 P(sp vsE 7 UEC 7 c xa A x vs 9 ctsq 9 u 9 h @vs w 9 Ga vT vs u 9 P(sp vYsE 7 UEC 7 c } Wu c xu V6qy y P G (sp s w h w 9 p u p pus y 97 HGG s 7 w 9 c UGG s hwC 7 HEC 7 c G Bu UhDCSs q 9 Ga s T H9G @huDCSs q @7 hpC |9z Ia A u C vs 9 f(sSrp w C u DCp sU`SC$vBa x v G s h @86
S i g U i g S U 4FBFpVqi
Pe
rwHp 9E & 9 sd@dPrq$u E9 dr9 v &bua q p HESCp 9 7 hpYCvs G druq 9 $u C @7 p p v SCcsH`DC$vBa q s p 9 s u p pus s p 9p u p pus G Bu HhYCw xa A huC @7 mu q Vrqq 9 v SCcsH`DC$vBa p pa 9 pus 5 q 9 p G s y Ia A xP W7 p twHp 9E & 9 u DCp sU`SC$vBa x pcs 7 pwIps c 99 q 7 p 9 vs 9 q 9@86 f 9 daDHpE@YaqtVpw u s u 9 w d)v Hp 9E & 9 @7 p 9 u vs V9 HGG ec 9 pw C 7 Fu q 7 q Cu y 9 C C c p j uhqpn Si rj 4FBFpVqi segj o e i S i g U i g S U
9 p c ( f s a sE a p c E u Cq T b u u q aw q a q F q @9 vs A HEgp @7 xb 74 9b p dF GE P 8p s 7 mtp 9 @vs Dvs g@vs vs 9 9b xDvs 9 dvp 9 vs A v f 9 @vs YCvs T H9@A vrsw W7 p 9 dYavs 9 6 Eu q G 9 q w g P } z wa 9 dmVw G t fu G 9 p p 4vs 9 H9WA vrsw @7 ihwC Yfxa A huC 7 1p9 @7 p V6qy vrrqq i@7 ihwC @vCS 1S S S g P 9 q 9 ( q 9 9 p bus S 9
a 5 s G (Vq 6y h@u ec UGG 6y @7 p 9 w f 9 w Pdu u hCSp YsH`SC$vda x dP p v 9 @vs YCvs T H9WA vrsm@vvs 9 H9@A vtsw @7 p 9 p s G a GE iv C 9 C pus qa y Eu q G w bus u G 9 s F U@A vs 9 9G V hwC 7 p u C 9 HECdP$ G q 9 T dYarwq 9 hvs G vstq v 9 Wv(s qp A C @7 p xfPs ctsdb vsxdv DCx Ga Wu Yp s 7 6 u bs w T q au hy Eu 9 paI q a p u E wu w E E F T I s w u Cp a sE q a @9 fPidv Scs G GE YddP p rp 9b vs A HE 9 du 9 w 9 PlqhwC 7 qw 9 qrxs 9 vs @7 p 9 HbDCrwx w HGG sqq rVqq 9 u hSCp YsH`DCu Ba W7 p w 9 hSCp vl q w s p f q 9 pa y p s x9 pus c 7 $d v YfwVq rVqq 9 u DCp sU`SC$vsBa 2@7 p GUG s xu PtsvYE 7 UEC 7 dq rHp 9E s 9 p rsq 9 u 9 G Hfq 9 U`SC$vBa 2@7 p 7 @rq 7 p pua pu x 9 w C pu c T pus x 9 ha @7 @huSCrpIa A @vw H9G IPs DCvs T dWvtsq uvs YCrwdaPs S 1S S S g @u DCp tsq 9 u 9 h mdu hSCp s G Fa GE sE dvp Vpw 6 pI w qa 9 9 p h p bus q bu w h S h f A a 9 p CDq 8dvhuC 9 vVq qvp 9 HE @7 p 9 UbTVot c qap p c a b 9 C q w s bua q bu E q wu Eu } f G ay 9 xa 9 IgplWdr@vs FG9 C@FvIBdv SCp @day t 6 t u b a pu x 9 p b y q 97 I A 9 @86z f4fs FG9 q i@7 pu C 9b vHhCDw 9 P p8q 9 H`SC$vsda B@7 pitw$u 9 U9G@A hC p s 7 p 9 RYE t 6 t v C9E9 A s 9 hpDC6 je ig SU l S ig udhpVqi m 4FBU i sn i
U 2U g
S hyi ij
f 9 bPl 9 Ts 7 pduv SCp A dYarwvmu s 9 p (s wp Gp vs H9G q@viw G f(sp 9 b 9 UTu UhDCw 9 b Wvmu hSCp s G Fa GE sedvqu s a w ws p q E bus C Ch bus E qap f 9 hwCdqvs G uvtsvh @u s f$ G q 9 TC@hu@@ Ga @huC 9 w Pdu DCp sU`SC$vBa ~UGG tsq 9 T @7 u HhYCw 9 edP gu C 9 @ Ga @u u a q b bs h Cb E Cu pus x 9 p b qa p b E f 9 w dPs G q 9 TEvspp GC @PBVq i@7 p du hSCp s G Fa GE squ HhYCw 9 edP gu C 9 @ Ga @u Cu b y CIsI A 9 w E b qa p b E
fe
w h p T h uC p 9G C y w C s E G 9 q 6 f p 9G V 9 9 F rq 9 p G @u G Yq 9 @hS$u 9 U@A h8q 6odu Dp UC @A C @7 p 9 vs p s 7 %$u 9 lv v F w U@A vs B9 w W7 p u F99 cp 9 I 9 @vs YCvs q Vrqq @7 p xfPs 9 HEDCvdu ydmcps 7 6 Hfq 9 p G "eg 7 v@u H9g@7 Sq 6ShwC 7 Cp s 0A9 Eu q T 9 9 paI p a p b ph G 9 p y p 9 fxa A xq 9 p @iW7 Wv q rVqq i@7 Wv 9 @vs YCvs T @7 p huP(sxP vrrqq 9 u DCp sU`SC$vBa x p pa G 9 py 9 9 py Eu q 9 C pI q pus C 9 p bus pus u b p 9 y p pa 9 p h q 7 hpec 9 u @7 P@v)q Vrqq 9 u DCp sU`SC$vBa x dPs 7 p s 7 q 9 p G @7 p r6q)xa A x W7 @u YCvs A YE c I Yfq 9 p @ hwC 7 p r$u C G} Bu UhDCw xa A u C @7 u u hSCp YsH`SC$vda x @u DCp s G ( YCw z w U9G Ps DCvs T p s p 9p pus h a I q G u wsa RP 9 w fI A 9 p vs DCVwvBh F6%QD52 @7 p Vpq 9 du Ps G9 q i@7 huC 9b u UhDCw 9 veq 9 U`SC$vBa i@7 C@huDCda p G Daw 9 q 9 U`SC$vBa x @Ps b ap pus x 9 p h w pus bb E bus 7 Ps 9 Wvu DCp sUEC @A SCp G ( 7 Ps 9 q 9 yp t Hfq 9 p G @7 p $u 9 U9@A gtp 9 vrq yvp 9 RYE @7 qq 9 T mvc I G a E 9 p G C p c a b 9 p h f G Bu HhYCw xa A I @7 p huP(sxuHfq 9 p G (7 v@u H9G s p pa 9 C pI w ph qa p p 9 p dP 2r$u C 9 w @7 p xa A u C 9 T fP 9b dgvhdu hSCp YsH` GC s 9 q U9G Ps YCvs T d@vrsq vs DCrwxP$iS S S 1S g @7 )@huDCw Is wa ap w I q bu u wash S 9 p h f $ e #A a w E & p E qa f w a pa p w pI pa 9 I Gb 7 p@u 9 a Fx9 6qy srxFaidP 4 9b da p 9 huSCxVq 7 UEC 7 c 9 v I f } du UhDCw 9 b 7 v8iq 6y 9 u SCIrq 9 tsw w s b 9 9 w z C a pa q b pu h wa e bu ph y @7 p 9 da 7 w ec P p 9 u DCxrsu HhYCw 9 vs Wu DCxB"g @vs 7 vWu H9G v q 9 p G Vwvs A c G mu HhYCw 9 p VdI f g bu ph y bu I"e@vs q7 v@u H9G vq U9G p U9G @vs 7 rp H9G Ps 9 Gb 7 w 9 RYed Hfq 9 p G I I a b E qa u s t$u 9 U@A xp s 7 p 9 Hy C9E9 A s 9 hYq p rq q 9 p G 9 u DxVq t 6 t XW7 p 9 dvs 7 p q @7 p s w p 9G C b E pC c w C p a 9 w a u 9 f U9G P(sp ddm@huC H 9E I H9G f(sVpw 9 q 9 8cps 7 rwq 9 p G u ep G Daw 9 mpshwC 86 Hfps c I wua h I c p C q s 7 w I C ua Cw b h C wy 99 & bua p v 9 U9G P(sp HE@ 9b q A dmu vrq `9 @u s w H9G A @u RTlS Gp p 7 Hh GC 4v Hp 9E & d@7 p w s 7 ssWdrq $u E9 r 9 f 9 q W7 twp 9E & 9 p 9 w @7 sW@Sa wp vdu HGG ec 9 6 Hftw$u E9 dr9 YE 9 w @7 Wv du hDCrwq 9 9b H`SC$vda x 9b da 9 Ps 9 Vpdu u HhYCw 9 8q 9 p @iW7 p 9 p pb p C 9 py w T pus w c b w f b G 9 pI 9b p tsq 9 u 9 h 9 w 7 p p du 9 vs 9 da 9 xtw$u E9 r 9 HE @7 p u @7 I8fs 9 HE rwHp 9E & 9 s @dVq u 9 CE r 9 v q w c p & bua p 9 9 c paI Yfq 9 @Ps @vs q C9 @A SCp G ( 7 Ps 9 q 9 yp 9b fs @A hwdq 9 H`DC$vBa x s da 86 HftwhpWI vs 7 p 9 q 9 hq@a Fx9 q pl bb bu G a E s E G C pus w 7 C u C s p pa 9 wbb xa A x @7 p d@fs 9 rw @vsu DCp sUEC @A SCp G (u s q 9 yp qq 9 9T c ( f } w C9 @A SCp G ( q x@Ps 9 UC |Gz du hSCp rsq XA bus G ap s G a wbb w 9 u F99 cp 9 I u hSCp lrq 6Iu C W7 p YpVqvs2tow 9 huC Gp u 9 vs 9 q @7 p cps 7 p dvs 9 w C 7 9b c HGG s 9 vs UESCp 9 7 hpYCvWv s y 9 qE p G q 9 wu p q qsy wrhp@I Gp u u @7 6 Yfw c HGG 6y v 9b u Ps @Ve9 I 9 vsE HESCp 9 7 hpYCvs G druq 9 $u C @7 p cpoq rVqq 9 u hSCp YsH`SC$vda C 9 ws C GA 9 I u q s p 9 s pus Yfq 9 p G @7 Wv xa A x @7 p twp 9E & 9 rudDamu 8w C 7 @vs q p C p bu 9 py p pa 9 u hSCp YsH`DCu Ba x u C 9b q 9 p G ihw~y FG9 rwhpxa A huC @86 f 9 Ps @A w 9 P(s@huDCq 9 p G 9 q 6y 9 Hp 9E & 9 vs hwC 9 viVpVwq @86 p s s C Cp 97 E G p h I u u 97