Accelerating the pace of engineering and science

# Documentation

Package: dsp

## Description

The DyadicAnalysisFilterBank object uses a series of highpass and lowpass FIR filters to provide approximate octave band frequency decompositions of the input. Each filter output is downsampled by a factor of two. With the appropriate analysis filters and tree structure, the dyadic analysis filter bank is a discrete wavelet transform (DWT) or discrete wavelet packet transform (DWPT).

To obtain approximate octave band frequency decompositions of the input:

1. Define and set up your dyadic analysis filter bank. See Construction.

2. Call step to get the octave half band frequency decompositions of the input according to the properties of dsp.DyadicAnalysisFilterBank. The behavior of step is specific to each object in the toolbox.

## Construction

H = dsp.DyadicAnalysisFilterBank constructs a dyadic analysis filter bank object, H, that computes the level-two discrete wavelet transform (DWT) of a column vector input. For a 2-D matrix input, the object transforms the columns using the Daubechies third-order extremal phase wavelet. The length of the input along the first dimension must be a multiple of 4.

H = dsp.DyadicAnalysisFilterBank('PropertyName',PropertyValue, ...) returns a dyadic analysis filter bank object, H, with each property set to the specified value.

## Properties

Filter

Type of filter used in subband decomposition

Specify the type of filter used to determine the high and lowpass FIR filters in the dyadic analysis filter bank as Custom , Haar, Daubechies, Symlets, Coiflets, Biorthogonal, Reverse Biorthogonal, or Discrete Meyer. All property values except Custom require Wavelet Toolbox™ software. If the value of this property is Custom, the filter coefficients are specified by the values of the CustomLowpassFilter and CustomHighpassFilter properties. Otherwise, the dyadic analysis filter bank object uses the Wavelet Toolbox function wfilters to construct the filters. The following table lists supported wavelet filters and example syntax to construct the filters:

FilterExample SettingSyntax for Analysis Filters
HaarN/A[Lo_D,Hi_D]=wfilters('haar');
Daubechies extremal phaseWaveletOrder=3;[Lo_D,Hi_D]=wfilters('db3');
Symlets (Daubechies least-asymmetric)WaveletOrder=4;[Lo_D,Hi_D]=wfilters('sym4');
Coiflets WaveletOrder=1;[Lo_D,Hi_D]=wfilters('coif1');
BiorthogonalFilterOrder='[3/1]';[Lo_D,Hi_D,Lo_R,Hi_R]=... wfilters('bior3.1');
Reverse biorthogonalFilterOrder='[3/1]';[Lo_D,Hi_D,Lo_R,Hi_R]=... wfilters('rbior3.1');
Discrete MeyerN/A[Lo_D,Hi_D]=wfilters('dmey');

CustomLowpassFilter

Lowpass FIR filter coefficients

Specify a vector of lowpass FIR filter coefficients, in powers of z-1. Use a half-band filter that passes the frequency band stopped by the filter specified in the CustomHighpassFilter property. This property applies when you set the Filter property to Custom. The default specifies a Daubechies third-order extremal phase scaling (lowpass) filter.

CustomHighpassFilter

Highpass FIR filter coefficients

Specify a vector of highpass FIR filter coefficients, in powers of z-1. Use a half-band filter that passes the frequency band stopped by the filter specified in the CustomLowpassFilter property. This property applies when you set the Filter property to Custom. The default specifies a Daubechies 3rd-order extremal phase wavelet (highpass) filter.

WaveletOrder

Order for orthogonal wavelets

Specify the order of the wavelet selected in the Filter property. This property applies when you set the Filter property to an orthogonal wavelet: Daubechies (Daubechies extremal phase), Symlets (Daubechies least-asymmetric), or Coiflets. The default is 2.

FilterOrder

Analysis and synthesis filter orders for biorthogonal filters

Specify the order of the analysis and synthesis filter orders for biorthogonal filter banks as 1 / 1, 1 / 3, 1 / 5, 2 / 2, 2 / 4, 2 / 6, 2 / 8, 3 / 1, 3 / 3, 3 / 5, 3 / 7, 3 / 9, 4 / 4, or 5 / 5, 6 / 8. Unlike orthogonal wavelets, biorthogonal wavelets require different filters for the analysis (decomposition) and synthesis (reconstruction) of an input. The first number indicates the order of the synthesis (reconstruction) filter. The second number indicates the order of the analysis (decomposition) filter. This property applies when you set the Filter property to Biorthogonal or Reverse Biorthogonal. The default is 1 / 1.

NumLevels

Number of filter bank levels used in analysis (decomposition)

Specify the number of filter bank analysis levels a positive integer. A level-N asymmetric structure produces N+1 output subbands. A level-N symmetric structure produces 2N output subbands. The default is 2. The size of the input along the first dimension must be a multiple of 2N, where N is the number of levels.

TreeStructure

Structure of filter bank

Specify the structure of the filter bank as Asymmetric or Symmetric. The asymmetric structure decomposes only the lowpass filter output from each level. The symmetric structure decomposes the highpass and lowpass filter outputs from each level. If the analysis filters are scaling (lowpass) and wavelet (highpass) filters, the asymmetric structure is the discrete wavelet transform, while the symmetric structure is the discrete wavelet packet transform.

When this property is Symmetric, the output has 2N subbands each of size M/2N. In this case, M is the length of the input along the first dimension and N is the value of the NumLevels property. When this property is Asymmetric, the output has N+1 subbands. The following equation gives the length of the output in the kth subband in the asymmetric case:

${M}_{k}=\left\{\begin{array}{ll}\frac{M}{{2}^{k}}\hfill & 1\le k\le N\hfill \\ \frac{M}{{2}^{N}}\hfill & k=N+1\hfill \end{array}$

The default is Asymmetric.

## Methods

 clone Create dyadic analysis filter bank object with same property values getNumInputs Number of expected inputs to step method getNumOutputs Number of outputs of step method isLocked Locked status for input attributes and nontunable properties release Allow property value and input characteristics changes reset Reset filter states step Decompose input with dyadic filter bank

## Examples

Denoise square wave input using dyadic analysis and synthesis filter banks:

``` t = 0:.0001:.0511;
x= square(2*pi*30*t);
xn = x' + 0.08*randn(length(x),1);

% The filter coefficients correspond to a 'haar' wavelet.
hdydanl.CustomLowpassFilter = [1/sqrt(2) 1/sqrt(2)];
hdydanl.CustomHighpassFilter = [-1/sqrt(2) 1/sqrt(2)];
hdydsyn.CustomLowpassFilter = [1/sqrt(2) 1/sqrt(2)];
hdydsyn.CustomHighpassFilter = [1/sqrt(2) -1/sqrt(2)];

C = step(hdydanl, xn);

% Subband outputs
C1 = C(1:256); C2 = C(257:384); C3 = C(385:512);

% Set higher frequency coefficients to zero
% to remove the noise.
x_den = step(hdydsyn, [zeros(length(C1),1);...
zeros(length(C2),1);C3]);

subplot(2,1,1), plot(xn); title('Original noisy Signal');
subplot(2,1,2), plot(x_den); title('Denoised Signal');
```

## Algorithms

This object implements the algorithm, inputs, and outputs described on the Dyadic Analysis Filter Bank block reference page. The object properties correspond to the block parameters, except:

 The dyadic analysis filter bank object always concatenates the subbands into a single column vector for a column vector input, or into the columns of a matrix for a matrix input. This behavior corresponds to the block's behavior when you set the Output parameter to Single port.