Description

The dsp.DyadicAnalysisFilterBank System object™ decomposes a broadband signal into a collection of subbands with smaller bandwidths and slower sample rates. The System 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. Create the dsp.DyadicAnalysisFilterBank object and set its properties.

2. Call the object with arguments, as if it were a function.

Creation

Description

example

dydan = dsp.DyadicAnalysisFilterBank constructs a dyadic analysis filter bank object, dydan, 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.

example

dydan = dsp.DyadicAnalysisFilterBank(Name,Value) returns a dyadic analysis filter bank object, with each property set to the specified value.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

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');

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. The default specifies a Daubechies third-order extremal phase scaling (lowpass) filter.

Dependencies

This property applies when you set the Filter property to Custom.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

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. The default specifies a Daubechies 3rd-order extremal phase wavelet (highpass) filter.

Dependencies

This property applies when you set the Filter property to Custom.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Specify the order of the wavelet selected in the Filter property.

Dependencies

This property applies when you set the Filter property to an orthogonal wavelet: Daubechies (Daubechies extremal phase), Symlets (Daubechies least-asymmetric), or Coiflets.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | fi

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, 5 / 5, or 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.

Dependencies

This property applies when you set the Filter property to Biorthogonal or Reverse Biorthogonal.

Data Types: char

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

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

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}$

Usage

Description

example

y = dydan(x) computes the subband decomposition of the input x and outputs the dyadic subband decomposition in y as a single concatenated column vector or matrix of coefficients.

Input Arguments

expand all

Data input, specified as a column vector or a matrix. Each column of x is treated as an independent input, and the number of rows of x must be a multiple of ${2}^{N},$ where N is the number of levels specified by the NumLevels property.

Data Types: single | double
Complex Number Support: Yes

Output Arguments

expand all

Dyadic subband decomposition output, returned as a column vector or a matrix. The elements of y are ordered with the highest-frequency subband first followed by subbands in decreasing frequency.

When TreeStructure is set to 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 TreeStructure is set to 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}$

Data Types: single | double
Complex Number Support: Yes

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

 step Run System object algorithm release Release resources and allow changes to System object property values and input characteristics reset Reset internal states of System object

Examples

collapse all

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

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.

dydanl.CustomLowpassFilter = [1/sqrt(2) 1/sqrt(2)];
dydanl.CustomHighpassFilter = [-1/sqrt(2) 1/sqrt(2)];
dydsyn.CustomLowpassFilter = [1/sqrt(2) 1/sqrt(2)];
dydsyn.CustomHighpassFilter = [1/sqrt(2) -1/sqrt(2)];
C = dydanl(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 = dydsyn([zeros(length(C1),1);...
zeros(length(C2),1);C3]);

Plot the original and denoised signals.

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

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

Sampling frequency 1 kHz input length 1024

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

Default asymmetric structure with order 3 extremal phase wavelet

Y = dydan(xn);

Level 2 yields 3 subbands (two detail-one approximation) Nyquist frequency is 500 Hz

D1 = Y(1:512); % subband approx. [250, 500] Hz
D2 = Y(513:768); % subband approx. [125, 250] Hz
Approx = Y(769:1024); % subband approx. [0,125] Hz

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

Sampling frequency 1 kHz input length 1024.

t = 0:.001:1.023;
x = square(2*pi*30*t);
xn = x' + 0.08*randn(length(x),1);
'Symmetric');
Y = dydan(xn);
D1 = Y(1:256); % subband approx. [375,500] Hz
D2 = Y(257:512); % subband approx. [250,375] Hz
D3 = Y(513:768); % subband approx. [125,250] Hz
Approx = Y(769:1024); % subband approx. [0, 125] Hz

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.

Version History

Introduced in R2012a