| Signal Processing Blockset™ | ![]() |
Filtering / Multirate Filters
dspmlti4
The Two-Channel Analysis Subband Filter block decomposes the input into a high-frequency subband and a low-frequency subband, 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.

Note that 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 illustrated above. Each subband is the first phase of the respective polyphase filter.
You must provide the vector of filter coefficients for the two filters. Each filter should be a half-band filter that passes the frequency band that the other filter stops. For frame-based inputs, you also need to specify whether the change in the sample rate of the output gets reflected by a change in the frame size, or the frame rate.
Note By connecting many copies of this block, you can implement a multilevel dyadic analysis filter bank. In some cases, it is more efficient to use the Dyadic Analysis Filter Bank block instead. For more information, see Creating Multilevel Dyadic Analysis Filter Banks. |
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)].
![]()
Each filter should be a half-band filter that passes the frequency band that the other filter stops. When you plan to 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.
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 Filter Design Toolbox functions and Signal Processing Toolbox functions. To learn how to design your own perfect reconstruction filters, see References.
The block initializes all filter states to zero.
The block accepts all M-by-N sample-based matrix inputs. The
block treats such inputs as
independent
channels, and decomposes each channel over time.
Given a sample-based M-by-N input, the block outputs two M-by-N sample-based matrices whose sample rates are half the input sample rate. Each output matrix element is the high- or low-frequency subband output of the corresponding input matrix element. Depending on the Simulink configuration parameters, some sample-based outputs can have one sample of latency, as described in Latency.
The block accepts M-by-N frame-based matrix inputs where M is a multiple of two. The block treats such inputs as N independent channels, and decomposes each channel over time.
Given a valid frame-based input, the block outputs two frame-based matrices. Each output column is the high- or low-frequency subband of the corresponding input column.
The sample rate of the outputs are half that of the input. The Framing parameter sets whether the block halves the sample rate by halving the output frame size, or halving the output frame rate:
Maintain input frame size — The input and output frame sizes are the same, but the frame rate of the outputs are half that of the input. So, the overall sample rate of the output is half that of the input. This setting causes the block to have one frame of latency, as described in Latency.
Maintain input frame rate — The input and output frame rates are the same, but the frame size of the outputs are half that of the input (the input frame size must be a multiple of two). So, the overall sample rate of the output is half that of the input.
In some cases, the block has nonzero tasking latency, which means that there is a constant delay between the time that the block receives an input, and produces the corresponding output, as summarized below and in the following table:
For sample-based inputs, there are cases where the block exhibits one-sample latency. In such cases, when the block receives the nth input sample, it produces the outputs corresponding to the n-1th input sample. When the block receives the first input sample, the block outputs an initial value of zero in each output channel.
For frame-based inputs, there are cases where the block exhibits one-frame latency. In such cases, when the block receives the nth input frame, it produces the outputs corresponding to the n-1th input frame. When the block receives the first input frame, the block outputs a frame of zeros.
Note For more information on latency and the Simulink tasking modes, see Excess Algorithmic Delay (Tasking Latency) and Models with Multiple Sample Rates in the Real-Time Workshop User's Guide. |
Amount of Block Latency for All Possible Block Settings
| Input | Latency | No Latency |
|---|---|---|
Sample based | One sample of latency when the Tasking mode for periodic sample times parameter is set to MultiTasking or Auto in the Solver pane of the Configuration Parameters dialog box. The first output sample of each channel is always 0. | The Tasking mode for periodic sample times parameter is set to SingleTasking in the Solver pane of the Configuration Parameters dialog box. |
Frame based | One frame of latency when the Framing parameter is set to Maintain input frame size. The first output frame is always all zeros. | The Framing parameter is set to Maintain input frame rate. |
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. See the previous table, Amount of Block Latency for All Possible Block Settings
For instance, for frame-based inputs, the filter bank output values differ depending on whether you set the Framing parameter to Maintain input frame rate (no latency), or Maintain input frame size (one frame of latency for every block). Though the output values differ, both sets of values are valid; the difference arises from changes in latency.
In some cases, rather than connecting several Two-Channel Analysis Subband Filter blocks, it is faster and requires less memory to use the Dyadic Analysis Filter Bank block. In particular, use the Dyadic Analysis Filter Bank block when you want to decompose a frame-based signal with frame size a multiple of 2n into n+1 or 2n 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 block is comprised 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.
See the following Signal Processing Blockset demos, which use the Two-Channel Analysis Subband Filter block:
Note By default, the demos open the versions using the Two-Channel Analysis Subband Filter block. You can also see the version of the demos that use the Dyadic Analysis Filter Bank block by clicking the Frame-Based Demo button in the demos. |
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 3rd-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 3rd-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 the method by which to implement the decimation for frame-based inputs:
Select Maintain input frame size to halve the output frame rate
Select Maintain input frame rate to halve the output frame size
For more information, see Frame-Based Operation. Some settings of this parameter causes the block to have nonzero latency, as described in Latency.
The Fixed-point 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 always round to Nearest.
Select the overflow mode for fixed-point operations. The filter coefficients do not obey this parameter; they are always saturated.
Choose how you specify the word length and the fraction length of the FIR filter coefficients:
When you select Same word length as input, the word length of the filter coefficients match that of the input to the block. In this mode, the fraction length of the coefficients is automatically set to the binary-point only scaling that provides you with the best precision possible given the value and word length of the coefficients.
When you select Specify word length, you can enter the word length of the coefficients, in bits. In this mode, the fraction length of the coefficients is automatically set to the binary-point only scaling that provides you with the best precision possible given the value and word length of the coefficients.
When you select Binary point scaling, you can enter the word length and the fraction length of the coefficients, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the coefficients. This block requires power-of-two slope and a bias of zero.
The filter coefficients do not obey the Rounding mode and the Overflow mode parameters; they are always saturated and rounded to Nearest.
Use this parameter to specify how you would like to designate the product output word and fraction lengths. See Fixed-Point Data Types of the FIR Decimation reference page and Multiplication Data Types for illustrations depicting the use of the product output data type in the FIR Decimation blocks of this block:
When you select Inherit via internal rule, the product output word length and fraction length are calculated automatically. For information about how the product output word and fraction lengths are calculated when an internal rule is used, see 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. |
When you select Same as input, these characteristics match those of the input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the product output, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the product output. This block requires power-of-two slope and a bias of zero.

As depicted above, inputs to the accumulator are cast to the accumulator data type. The output of the adder remains in the accumulator data type as each element of the input is added to it. Use this parameter to specify how you would like to designate this accumulator word and fraction lengths.
You also use this parameter to specify the accumulator word and fraction lengths resulting from a complex-complex multiplication in the FIR Decimation blocks in this block. See Multiplication Data Types for more information:
When you select Inherit via internal rule, the accumulator word length and fraction length are calculated automatically. For information about how the accumulator word and fraction lengths are calculated when an internal rule is used, see Inherit via Internal Rule.
When you select Same as product output, these characteristics match those of the product output
When you select Same as input, these characteristics match those of the input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the accumulator, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the accumulator. This block requires power-of-two slope and a bias of zero.
Choose how you specify the output word length and fraction length of the FIR Decimation blocks, as well as of the final overall filter output:
When you select Same as accumulator, these characteristics match those of the accumulator.
A special case occurs when Inherit via internal rule is specified for Accumulator, and block inputs and coefficients are complex. In that case, the output word length is one less than the accumulator word length.
When you select Same as product output, these characteristics match those of the product output
When you select Same as input, these characteristics match those of the input to the block.
When you select Binary point scaling, you can enter the word length and the fraction length of the output, in bits.
When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the output. This block requires power-of-two slope and a bias of zero.
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
| Dyadic Analysis Filter Bank | Signal Processing Blockset |
| FIR Decimation | Signal Processing Blockset |
| Two-Channel Synthesis Subband Filter | Signal Processing Blockset |
| fir1 | Signal Processing Toolbox |
| fir2 | Signal Processing Toolbox |
| firls | Signal Processing Toolbox |
| wfilters | Wavelet Toolbox |
For related information, see Multirate Filters.
![]() | Triggered To Workspace | Two-Channel Synthesis Subband Filter | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |