FIR Halfband Decimator
Decimate signal using polyphase FIR halfband filter
Library
Filtering/Filter Designs
dspfdesign
Description
The FIR Halfband Decimator block performs polyphase decimation of the input signal by a factor of two. The block uses an FIR equiripple design or a Kaiser window design to construct the halfband filters. The implementation takes advantage of the zerovalued coefficients of the FIR halfband filter, making one of the polyphase branches a delay. You can also use the block to implement the analysis portion of a twoband filter bank to separate a signal into lowpass and highpass subbands. For more information, see Algorithms.
The input signal can be a real or complexvalued column vector or matrix. If the input signal is a matrix, the block treats each column of the matrix as an independent channel. The number of rows in the input signal must be a multiple of 2. The block supports fixedpoint operations and ARM^{®} Cortex^{®} code generation. For more information on ARM Cortex code generation, see Code Generation for ARM CortexM and ARM CortexA Processors.
Dialog Box
Main Tab
 Filter specification
Parameters used to design the FIR halfband filter.
Transition width and stopband attenuation
(default) — Design the filter using Transition width (Hz) and Stopband attenuation (dB). This design is the minimum order design.Filter order and transition width
— Design the filter using Filter order and Transition width (Hz).Filter order and stopband attenuation
— Design the filter using Filter order and Stopband attenuation (dB).Coefficients
— Specify the filter coefficients directly through the Numerator parameter.
 Transition width (Hz)
Transition width, specified as a real positive scalar in Hz. The transition width must be less than half the input sample rate. You can specify the transition width when Filter specification is set to
Filter order and transition width
orTransition width and stopband attenuation
. The default is4.1e3
. Filter order
Filter order, specified as an even positive integer. You can specify the filter order when Filter specification is set to
Filter order and transition width
orFilter order and stopband attenuation
. The default is52
. Stopband attenuation (dB)
Stopband attenuation, specified as a real positive scalar in dB. You can specify the stopband attenuation when Filter specification is set to
Filter order and stopband attenuation
orTransition width and stopband attenuation
. The default is80
. Numerator
Specify the FIR halfband filter coefficients directly as a row vector. The coefficients must comply with the FIR halfband impulse response format. If half the order of the filter,
(length(Numerator)  1)/2
, is even, every other coefficient starting from the first coefficient must be a zero except for the center coefficient which must be a 0.5. If half the order of the filter is odd, the sequence of alternating zeros with a 0.5 at the center starts at the second coefficient.This parameter appears when Filter specification is set to
Coefficients
. The default is the coefficients vector returned byfirhalfband("minorder",0.407,1e4)
. Design method
Specify the filter design method as one of the following:
Auto
–– The algorithm automatically chooses the filter design method depending on the filter design parameters. The algorithm uses the equiripple or the Kaiser window method to design the filter.If the design constraints are very tight, such as very high stopband attenuation or very narrow transition width, then the algorithm automatically chooses the Kaiser method, as this method is optimal for designing filters with very tight specifications. However, if the design constraints are not tight, then the algorithm chooses the equiripple method.
When you set the Design method parameter to
Auto
, you can determine the method used by the algorithm by examining the passband and stopband ripple characteristics of the designed filter. If the block used the equiripple method, the passband and stopband ripples of the designed filter have a constant amplitude in the frequency response. If the filter design method the block chooses in theAuto
mode is not suitable for your application, manually specify the Design method asEquiripple
orKaiser
.Equiripple
–– The algorithm uses the equiripple method.Kaiser
–– The algorithm uses the Kaiser window method.
This parameter appears when you set Filter specification to
Filter order and stopband attenuation
,Filter order and transition width
, orTransition width and stopband attenuation
. Output highpass subband
When you select this check box, the block acts as a synthesis filter bank and synthesizes a signal from the highpass and lowpass subbands. When you clear this check box, the block acts as an FIR halfband decimator and accepts a single vector– or matrix–valued input.
 Inherit sample rate from input
When you select this check box, the block inherits its sample rate from the input signal. When you clear this check box, you specify the sample rate in Input sample rate (Hz). This parameter appears when you set Filter specification to any option other than
Coefficients
. Input sample rate (Hz)
Input sample rate, specified as a scalar in Hz. The default is
44100
. This parameter appears when you set Filter specification to any option other thanCoefficients
and clear the Inherit sample rate from input parameter. View Filter Response
Opens the Filter Visualization Tool FVTool and displays the magnitude/phase response of the FIR Halfband Decimator. The response is based on the block dialog box parameters. Changes made to these parameters update FVTool.
To update the magnitude response while FVTool is running, modify the dialog box parameters and click Apply.
 Simulate using
Type of simulation to run. You can set this parameter to:
Code generation
(default)Simulate model using generated C code. The first time you run a simulation, Simulink^{®} generates C code for the block. The C code is reused for subsequent simulations, as long as the model does not change. This option requires additional startup time but provides faster simulation speed than
Interpreted execution
.Interpreted execution
Simulate model using the MATLAB^{®} interpreter. This option shortens startup time but has slower simulation speed than
Code generation
.
Data Types Tab
 Rounding mode
Rounding method for the output fixedpoint operations. The rounding methods are
Ceiling
,Convergent
,Floor
,Nearest
,Round
,Simplest
, andZero
. The default isFloor
. Coefficients
Fixedpoint data type of the coefficients, specified as one of the following:
fixdt(1,16)
(default) — Signed fixedpoint data type of word length16
, with binary point scaling. The block determines the fraction length automatically from the coefficient values in such a way that the coefficients occupy maximum representable range without overflowing.fixdt(1,16,0)
— Signed fixedpoint data type of word length16
and fraction length,0
. You can change the fraction length to any other integer value.<data type expression>
— Specify the data type using an expression that evaluates to a data type object, for example, numeric type (fixdt
,[ ]
,16
,15
). Specify the sign mode of this data type as[ ]
ortrue
.Refresh Data Type
— Refreshes to the default data type.
Click the Show data type assistant button to display the data type assistant, which helps you set the stage input parameter.
See Specify Data Types Using Data Type Assistant (Simulink) for more information.
Supported Data Types
Port  Supported Data Types 

Input 

Output 

See Also
dsp.FIRHalfbandInterpolator  DSP System Toolbox 
dsp.FIRHalfbandDecimator  DSP System Toolbox 
FIR Halfband Interpolator  DSP System Toolbox 