Decompose signal into high-frequency and low-frequency subbands
Filtering / Multirate Filters
dspmlti4
The Two-Channel Analysis Subband Filter block decomposes the input into high-frequency and low-frequency subbands, each with half the bandwidth and half the sample rate of the input.
The block filters the input with a pair of highpass and lowpass FIR filters, and then downsamples the results by 2, as illustrated in the following figure.
The block implements the FIR filtering and downsampling steps together using a polyphase filter structure, which is more efficient than the straightforward filter-then-decimate algorithm shown in the preceding figure. Each subband is the first phase of the respective polyphase filter. You can implement a multilevel dyadic analysis filter bank by connecting multiple copies of this block or by using the Dyadic Analysis Filter Bank block. See Creating Multilevel Dyadic Analysis Filter Banks for more information.
You must provide a vector of filter coefficients for the lowpass and highpass FIR filters. Each filter should be a half-band filter that passes the frequency band that the other filter stops.
See the following topics for more information about this block:
You must provide the vector of numerator coefficients for the lowpass and highpass filters in the Lowpass FIR filter coefficients and Highpass FIR filter coefficients parameters.
For example, to specify a filter with the following transfer
function, enter the vector [b(1) b(2) ... b(m)]
.
$$H\left(z\right)=B\left(z\right)={b}_{1}+{b}_{2}{z}^{-1}+\dots +{b}_{m}{z}^{-(m-1)}$$
Each filter should be a half-band filter that passes the frequency band that the other filter stops. You can use the Two-Channel Synthesis Subband Filter block to reconstruct the input to this block. To do so, you must design perfect reconstruction filters to use in the synthesis subband filter.
The best way to design perfect reconstruction filters is to
use the Wavelet Toolbox™ wfilters
function in
to design both the filters both in this block and in the Two-Channel Synthesis Subband Filter block.
You can also use other DSP System Toolbox™ and Signal Processing Toolbox™ functions.
To learn how to design your own perfect reconstruction filters, see References.
The Two-Channel Analysis Subband Filter block initializes all filter states to zero.
When you set the Input processing parameter
to Columns as channels (frame based)
, the
block accepts an M-by-N matrix.
The block treats each column of the input as the high- or low-frequency
subbands of the corresponding output channel. You can use the Rate
options parameter to specify how the block resamples the
input:
When you set the Rate options parameter
to Enforce single-rate processing
, the
input to the block can be an M-by-N matrix,
where M is a multiple of two. The block treats
each column of the input as an independent channel and decomposes
each channel over time. The block outputs two matrices, where each
column of the output is the high- or low-frequency subband of the
corresponding input column. To maintain the input sample rate, the
block decreases the output frame size by a factor of two.
When you set the Rate options parameter
to Allow multirate processing
, the block
treats an M_{i}-by-N matrix
input as N independent channels and decomposes
each channel over time. The block outputs two M-by-N matrices,
where each column of the output is the high- or low-frequency subband
of the corresponding input column. The input and output frame sizes are
the same, but the frame rate of the output is
half that of the input. Thus, the overall sample rate of the output
is half that of the input.
In this mode, the block has one frame of latency, as described in the Latency section.
When you set the Input processing parameter
to Elements as channels (sample based)
,
the block treats an M-by-N matrix
input as M · N independent
channels. The block decomposes each channel over time and outputs
two M-by-N matrices whose sample
rates are half the input sample rate. Each element in the output matrix
is the high- or low-frequency subband output of the corresponding
element of the input matrix.
Depending on the setting of your Simulink^{®} configuration parameters, the output may have one sample of latency, as described in the Latency section.
When you set the Input processing parameter
to Columns as channels (frame based)
and
the Rate options parameter to Enforce
single-rate processing
, the Two-Channel Analysis Subband
Filter block always has zero-tasking latency. Zero-tasking
latency means that the block propagates the first input
sample (received at time t=0
)
as the first output sample.
When you set the Rate options parameter
to Allow multirate processing
, the Two-Channel
Analysis Subband Filter block may exhibit latency. The amount of latency
depends on the setting of the Input processing parameter
of this block, and the setting of the Simulink Tasking
mode for periodic sample times configuration parameter.
The following table summarizes the conditions that produce latency
when the block is performing multirate processing.
Input processing | Tasking mode for periodic sample times | Latency |
---|---|---|
| SingleTasking | None. |
MultiTasking or Auto | One sample. The first output sample in each channel always
has a value of | |
| SingleTasking , MultiTasking or Auto | One frame. All samples in the first output frame have
a value of |
Note: For more information on latency and the Simulink tasking modes, see Excess Algorithmic Delay (Tasking Latency) and Time-Based Scheduling and Code Generation in the Simulink Coder™ documentation. |
The Two-Channel Analysis Subband Filter block is the basic unit of a dyadic analysis filter bank. You can connect several of these blocks to implement an n-level filter bank, as illustrated in the following figure. For a review of dyadic analysis filter banks, see the Dyadic Analysis Filter Bank block reference page.
When you create a filter bank by connecting multiple copies of this block, the output values of the filter bank differ depending on whether there is latency. Though the output values differ, both sets of values are valid; the difference arises from changes in latency. See the Latency section for more information about when latency can occur in the Two-Channel Analysis Subband Filter block.
In some cases, rather than connecting several Two-Channel Analysis Subband Filter blocks, you can use the Dyadic Analysis Filter Bank block, which is faster and requires less memory. In particular, the Dyadic Analysis Filter Bank block is more efficient under the following conditions:
The frame size of the signal you are decomposing is a multiple of 2^{n}.
You are decomposing the signal into n+1
or
2^{n} subbands.
In all other cases, use Two-Channel Analysis Subband Filter blocks to implement your filter banks.
The Dyadic Analysis Filter Bank block allows you to specify the filter bank filters by providing vectors of filter coefficients, just as this block does. The Dyadic Analysis Filter Bank block provides an additional option of using wavelet-based filters that the block designs by using a wavelet you specify.
The Two-Channel Analysis Subband Filter Bank block is composed of two FIR Decimation blocks as shown in the following diagram.
For fixed-point signals, you can set the coefficient, product output, accumulator, and output data types of the FIR Decimation blocks as discussed in Dialog Box. For a diagram showing the usage of these data types, see the FIR Decimation block reference page.
The Main pane of the Two-Channel Analysis Subband Filter block dialog appears as follows.
Specify a vector of lowpass FIR filter coefficients, in descending powers of z. The lowpass filter should be a half-band filter that passes the frequency band stopped by the filter specified in the Highpass FIR filter coefficients parameter. The default values of this parameter specify a filter based on a third-order Daubechies wavelet. When you use the Two-Channel Synthesis Subband Filter block to reconstruct the input to this block, you need to design perfect reconstruction filters to use in the synthesis subband filter. For more information, see Specifying the FIR Filters.
Specify a vector of highpass FIR filter coefficients, in descending powers of z. The highpass filter should be a half-band filter that passes the frequency band stopped by the filter specified in the Lowpass FIR filter coefficients parameter. The default values of this parameter specify a filter based on a third-order Daubechies wavelet. When you use the Two-Channel Synthesis Subband Filter block to reconstruct the input to this block, you need to design perfect reconstruction filters to use in the synthesis subband filter. For more information, see Specifying the FIR Filters.
Specify how the block should process the input. You can set this parameter to one of the following options:
Columns as channels (frame based)
—
When you select this option, the block treats each column of the input
as a separate channel.
Elements as channels (sample based)
—
When you select this option, the block treats each element of the
input as a separate channel.
Note:
The |
Specify the rate processing rule for the block. You can set this parameter to one of the following options:
Enforce single-rate processing
—
When you select this option, the block treats each column of the input
as an independent channel and decomposes each channel over time. The
output has the same sample rate as the input, but the output frame
size is half that of the input frame size. To select this option,
you must set the Input processing parameter to Columns
as channels (frame based)
.
Allow multirate processing
—
When you select this option, the input and output of the block are
the same size, but the sample rate of the output is half that of the
input.
Some settings of this parameter cause the block to have nonzero latency. See Latency for more information.
The Data Types pane of the Two-Channel Analysis Subband Filter block dialog appears as follows.
Select the rounding mode for fixed-point operations.
The filter coefficients do not obey this parameter; they are always
rounded to Nearest
.
Note: The Rounding mode and Overflow mode settings have no effect on numerical results when all the following conditions exist:
With these data type settings, the block is effectively operating in full precision mode. |
Select the overflow mode for fixed-point operations. The filter coefficients do not obey this parameter; they are always saturated.
Specify the coefficients data type. See Fixed-Point Data Types and Multiplication Data Types for illustrations depicting the use of the coefficients data type in this block. You can set it to:
A rule that inherits a data type, for example, Inherit:
Same word length as input
An expression that evaluates to a valid data type,
for example, fixdt(1,16,0)
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Coefficients data type parameter.
See Specify Data Types Using Data Type Assistant for more information.
Specify the product output data type. See Fixed-Point Data Types and Multiplication Data Types for illustrations depicting the use of the product output data type in this block. You can set it to:
A rule that inherits a data type, for example, Inherit:
Inherit via internal rule
Note The actual product output word length may be equal to or greater than the calculated ideal product output word length, depending on the settings on the Hardware Implementation pane of the Configuration Parameters dialog box. |
An expression that evaluates to a valid data type,
for example, fixdt(1,16,0)
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Product output data type parameter.
See Specify Data Types Using Data Type Assistant for more information.
Specify the accumulator data type. See Fixed-Point Data Types for illustrations depicting the use of the accumulator data type in this block. You can set this parameter to:
A rule that inherits a data type, for example, Inherit:
Inherit via internal rule
An expression that evaluates to a valid data type,
for example, fixdt(1,16,0)
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Accumulator data type parameter.
See Specify Data Types Using Data Type Assistant for more information.
Specify the output data type. See Fixed-Point Data Types for illustrations depicting the use of the output data type in this block. You can set it to:
A rule that inherits a data type, for example, Inherit:
Same as accumulator
An expression that evaluates to a valid data type,
for example, fixdt(1,16,0)
Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Output data type parameter.
See Specify Block Output Data Types for more information.
Specify the minimum value that the block should output. The
default value is []
(unspecified). Simulink software
uses this value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Specify the maximum value that the block should output. The
default value is []
(unspecified). Simulink software
uses this value to perform:
Simulation range checking (see Signal Ranges)
Automatic scaling of fixed-point data types
Select this parameter to prevent the fixed-point tools from overriding the data types you specify on the block mask.
Fliege, N. J. Multirate Digital Signal Processing: Multirate Systems, Filter Banks, Wavelets. West Sussex, England: John Wiley & Sons, 1994.
Strang, G. and T. Nguyen. Wavelets and Filter Banks. Wellesley, MA: Wellesley-Cambridge Press, 1996.
Vaidyanathan, P. P. Multirate Systems and Filter Banks. Englewood Cliffs, NJ: Prentice Hall, 1993.
Double-precision floating point
Single-precision floating point
Fixed point (signed only)
8-, 16-, and 32-bit signed integers
DWT | DSP System Toolbox |
Dyadic Analysis Filter Bank | DSP System Toolbox |
FIR Decimation | DSP System Toolbox |
IDWT | DSP System Toolbox |
Two-Channel Synthesis Subband Filter | DSP System Toolbox |
fir1 | Signal Processing Toolbox |
fir2 | Signal Processing Toolbox |
firls | Signal Processing Toolbox |
wfilters | Wavelet Toolbox |
For related information, see Multirate and Multistage Filters.