I. Summary
In addition to the programming method to implement the filter, the fdatool toolbox in MATLAB can also easily and quickly implement the filter design. In addition, FPGA, DSP, and other digital filters are implemented.AlgorithmFilter coefficients are often used, and the fdatool toolbox can be used to quickly obtain the filter coefficients.
Ii. Experimental Platform
Http://dt.ap-southeast-1.maxcompute.aliyun-inc.com
3. Implementation steps 3.1Filter indicators
If you need to design16LevelFirFilter (H (0) = 0), The given parameters are as follows:
(1)Low-pass filter
(2)Sampling frequencyFSIs48 khz, FilterFCIs10.8 kHz
(3)The input sequence bit width is9Bit (the highest bit is the symbol bit)
ExploitationMATLABTo completeFirDetermine the filter coefficient.
3.2OpenMATLABOfFdatool
MATLABIntegrates a set of powerful Filter Design ToolsFdatOOl (FilterDesign & Analysis Tool) To design, analyze, and evaluate the performance of multiple filters.
ClickMATLAB"Start"Button,B .1As shown in, select the"Toolbox"→"Filter Design"→"Filter Design & Analysis Tool(Fdatool) "Command to openFdatool,B .2.
FigureB .1FdatOOl.
FigureB .2 fdatOool Main Interface
In additionMATLABIn the main command window, type"Fdatool ", which can also be openedFdatOOlProgramInterface.
3.3SelectDesign Filter
A group of tool buttons are arranged in the lower left corner of the fdatool interface. The functions are described as follows:
● Create a multirate filter)
● Transform filter)
● Set quantization Parameters)
● Implement model (realize Model)
● Zero pole Editor (pole-zero editor)
● Import Filter)
● Design Filter)
Select the button to go to the filter design page and select the following,B .3.
FigureB .3 fdatOool DesignFirFilter
● The filter type (filer type) is low-pass (Low Pass)
● The design method is FIR and the window function method is used)
● Filter order (Filter order) Customized15
● The window type isKaiser,BetaIs0.5
●FSIs48 khz,FCIs10.8 kHz
Click the design filter iconMATLABComputingFirFilter coefficients for correlation analysis.
Its system functionsH (Z)The following formula can be used to indicate:
H (z) =
Obviously, the above statement can be written:
H (z) =
It can be viewed as15LevelFirThe output result of the filter goes through a unit delay unit., So inFdatOOlMedium,Think of it15LevelFirFilter to calculate parameters.
Therefore, when the filter order is set, it must be 1 less than the required one.
3.4Filter Analysis
FIR after the filter coefficient, FIR the filter performs performance analysis to check whether the filter meets the design requirements. The analysis procedure is as follows:
SelectFdatOOlMenu"Analysis"→"Magn1_response", Analyze the frequency response of the Start FrameB .4As shown in,XThe axis is the frequency,YAxis is the amplitude value (unit:DB).
FigureB .4 firFilter amplitude frequency response
Information about the current filter is listed on the left side of the figure:
● The filter type isDirect form fir(DirectITypeFirFilter)
● Order Number of filters15
Select"Analysis"→"Phase response", Analysis of startup phase frequency response,B .5. The figure showsFirThe phase response of the filter in the pass band is linear, that is, the filter is a linear phase filter.
FigureB .5Filter phase frequency response
FigureB .6The comparison between the amplitude-frequency characteristics and phase-frequency characteristics of the filter is displayed.Analysis"→"Magnqueue and phase responseTo start the analysis.
FigureB .6Amplitude frequency and phase frequency response of the filter
Select"Analysis"→"Group Delay responseTo start group latency analysis.
FdatoolThe following analysis tools are also provided:
● Group Latency Response Analysis.
● Impulse Response Analysis (Impulse Response),B .7.
● Step response analysis (Step Response),B .8.
● Zero pole graph analysis (Pole/Zero plot),B .9.
FigureB .7Impulse Response
FigureB .8Step Response
figure B .9 zero-pole graph
ObtainedFirThe filter coefficient can be selected by selecting"Analysis"→"Filter coefficients"To observe.B .10As shown in the following figure:FdatOOlCalculated15Level DirectITypeFirThe Partial Coefficient of the filter.
FigureB .10Filter Coefficient
3.5Quantization
As you can see,FdatOOlThe calculated value is a signed decimal number.FirIf the filter model requires an integer as the filter coefficient, it must be quantified and normalized. To do this, clickFdatOOlClick the tool button in the lower left corner to set quantitative parameters. There are three methods to quantify parameters: Double precision, single precision, and fixed point. Before using fixed-point quantization, make sure thatMATLABThe fixed-point toolbox has been installed and authorized accordingly.
3.6Export Filter Coefficient
SelectFdatool"File"→"Export"Command to openExport(Export) dialog box,B .11.
FigureB .11Filter CoefficientExportDialog Box
In this window, select export to workspace (Workplace). At this time, the filter coefficient is saved to a one-dimensional variable.Num. HoweverNumThe elements in are in decimal form:
Num =
Columns 1 through 9
-0.0369 0.0109 0.0558-0.0054-0.0873 0.0484 0.1805 0.4133
Columns 10 through 16
0.1805-0.0484-0.0873 0.0054 0.0558-0.0109
Therefore, the coefficient of the low-pass filter can be obtained.