WOLFRAM

Copy to clipboard.

gives the discrete wavelet transform (DWT) of an array of data.

Copy to clipboard.

gives the discrete wavelet transform using the wavelet wave.

Copy to clipboard.

gives the discrete wavelet transform using r levels of refinement.

Details and Options

  • DiscreteWaveletTransform gives a DiscreteWaveletData object representing a tree of wavelet coefficient arrays.
  • Properties of the DiscreteWaveletData dwd can be found using dwd["prop"], and a list of available properties can be found using dwd["Properties"].
  • The data can be any of the following:
  • listarbitrary-rank numerical array
    imagearbitrary Image object
    audioan Audio or sampled Sound object
  • The resulting wavelet coefficients are arrays of the same depth as the input data.
  • The possible wavelets wave include:
  • BattleLemarieWavelet[]BattleLemarié wavelets based on B-spline
    BiorthogonalSplineWavelet[]B-spline-based wavelet
    CoifletWavelet[]symmetric variant of Daubechies wavelets
    DaubechiesWavelet[]the Daubechies wavelets
    HaarWavelet[]classic Haar wavelet
    MeyerWavelet[]wavelet defined in the frequency domain
    ReverseBiorthogonalSplineWavelet[]B-spline-based wavelet (reverse dual and primal)
    ShannonWavelet[]sinc function-based wavelet
    SymletWavelet[]least asymmetric orthogonal wavelet
  • The default wave is HaarWavelet[].
  • With higher settings for the refinement level r, larger-scale features are resolved.
  • The default refinement level r is given by TemplateBox[{{{InterpretationBox[{log, _, DocumentationBuild`Utils`Private`Parenth[2]}, Log2, AutoDelete -> True], (, n, )}, +, {1, /, 2}}}, Floor], where is the minimum dimension of data. »
  • The tree of wavelet coefficients at level consists of coarse coefficients and detail coefficients , with representing the input data.
  • The forward transform is given by and . »
  • The inverse transform is given by . »
  • The are lowpass filter coefficients and are highpass filter coefficients that are defined for each wavelet family.
  • The dimensions of and are given by wd_(j+1)=TemplateBox[{{{1, /, 2},  , {(, {{wd, _, j}, +, fl, -, 2}, )}}}, Ceiling], where is the input data dimension and fl is the filter length for the corresponding wspec. »
  • The following options can be given:
  • MethodAutomaticmethod to use
    Padding "Periodic"how to extend data beyond boundaries
    WorkingPrecision MachinePrecisionprecision to use in internal computations
  • The settings for Padding are the same as those available in ArrayPad.
  • InverseWaveletTransform gives the inverse transform.

Examples

open allclose all

Basic Examples  (3)Summary of the most common use cases

Compute a discrete wavelet transform using the HaarWavelet:

Out[1]=1

Use Normal to view all coefficients:

Out[2]=2

Transform an audio signal:

Out[1]=1
Out[2]=2

Use dwd[,"Audio"] to extract coefficient signals:

Out[3]=3

Compute the inverse transform:

Out[4]=4

Transform an Image object:

Out[1]=1

Use dwd[,"Image"] to extract coefficient images:

Out[2]=2

Compute the inverse transform:

Out[3]=3

Scope  (36)Survey of the scope of standard use cases

Basic Uses  (6)

Compute a wavelet transform:

Out[1]=1

The resulting DiscreteWaveletData represents a tree of transform coefficients:

Out[2]=2

The inverse transform reconstructs the input:

Out[3]=3

Useful properties can be extracted from the DiscreteWaveletData object:

Out[1]=1

Get a full list of properties:

Out[2]=2

Get data and coefficient dimensions:

Out[3]=3
Out[4]=4

Use Normal to get all wavelet coefficients explicitly:

Out[2]=2

Also use All as an argument to get all coefficients:

Out[3]=3

Use Automatic to get only the coefficients used in the inverse transform:

Out[4]=4

Use the "TreeView" or "WaveletIndex" to find out what wavelet coefficients are available:

Out[2]=2
Out[3]=3

Extract specific coefficient arrays:

Out[4]=4
Out[5]=5

Extract several wavelet coefficients corresponding to the list of wavelet index specifications:

Out[6]=6

Extract all coefficients whose wavelet indexes match a pattern:

Out[7]=7
Out[8]=8

The Automatic coefficients are used by default in functions like WaveletListPlot:

Out[2]=2
Out[3]=3

Use a higher refinement level to increase the frequency resolution:

Out[2]=2

With a smaller refinement level, more signal energy is left in {0,0,0}:

Out[4]=4

With further refinement, {0,0,0} is resolved into further components:

Out[6]=6

Wavelet Families  (10)

Compute the discrete wavelet transform using different wavelet families:

Compare the coefficients:

Out[3]=3

Use different families of wavelets to capture different features:

Out[2]=2

HaarWavelet (default):

Out[4]=4

DaubechiesWavelet:

Out[3]=3

BattleLemarieWavelet:

Out[3]=3

BiorthogonalSplineWavelet:

Out[3]=3

CoifletWavelet:

Out[3]=3

MeyerWavelet:

Out[3]=3

ReverseBiorthogonalSplineWavelet:

Out[3]=3

ShannonWavelet:

Out[3]=3

SymletWavelet:

Out[3]=3

Vector Data  (6)

Plot the coefficients over a common horizontal axis using WaveletListPlot:

Out[2]=2

Plot against a common vertical axis:

Out[3]=3

Visualize coefficients as a function of time and refinement level using WaveletScalogram:

The coefficient indexes appear as tooltips when the mouse pointer is moved over a coefficient:

Out[2]=2

Constant data:

Out[2]=2

All coefficients are small except coarse coefficients {0,0,}:

Out[4]=4

Data oscillating at the highest resolvable frequency (Nyquist frequency):

Out[2]=2

Only the first detail coefficient {1} is not small:

Out[4]=4

Data with large discontinuities:

Out[2]=2

Coarse coefficients {0,} have the same large-scale structure as the data:

Out[4]=4

Detail coefficients are sensitive to discontinuities:

Out[5]=5

Data with both spatial and frequency structure:

Out[2]=2

Coarse coefficients {0,} track the local mean of the data:

Out[4]=4

The first detail coefficient identifies the oscillatory region:

Out[5]=5

All coefficients on a common vertical axis:

Out[6]=6

Matrix Data  (5)

Compute a two-dimensional discrete wavelet transform:

Out[1]=1

View the tree of wavelet coefficients:

Out[2]=2

Inverse transform to get back the original signal:

Use WaveletMatrixPlot to visualize the different wavelet coefficients:

Out[1]=1
Out[2]=2

WaveletMatrixPlot of wavelet transform at a higher refinement level:

Out[3]=3

In two dimensions, the vector of filtering operations in each direction can be computed:

Out[1]=1

Interpreting these vectors as binary digit expansions results in wavelet index numbers:

Out[2]=2

Get the lowpass and highpass filters for a Haar wavelet:

Out[1]=1

The resulting 2D filters are outer products of filters in the two directions:

Out[2]=2
Out[3]=3

Wavelet transform of step data:

Data with a vertical discontinuity:

Out[2]=2

Only the vertical detail coefficients, wavelet index {,1}, are nonzero:

Out[3]=3

Data with horizontal discontinuity:

Out[4]=4

Only the horizontal detail coefficients, wavelet index {,2}, are nonzero:

Out[5]=5

Data with diagonal discontinuity:

Out[6]=6

Only the diagonal detail coefficients, wavelet index {,3}, are nonzero:

Out[7]=7

Array Data  (2)

Compute a three-dimensional discrete wavelet transform:

Out[2]=2

Tree view of all coefficients:

Out[3]=3

Inverse transform to get back the original signal:

Out[4]=4

Wavelet transform of a three-dimensional cross array:

Out[2]=2
Out[3]=3

Visualize wavelet coefficients:

Out[4]=4

Energy of the original data is conserved within the transformed coefficients:

Out[5]=5

Image Data  (4)

Transform an Image object:

Out[1]=1
Out[2]=2

The inverse transform yields a reconstructed Image object:

Out[3]=3

Wavelet coefficients are normally given as lists of data for each image channel:

Out[2]=2

Get all coefficients as Image objects instead:

Out[3]=3

Get raw Image objects with no rescaling of color levels:

Out[4]=4

Get the inverse transform of the {0,1} coefficient as an Image object:

Out[5]=5

Plot coefficients used in the inverse transform in a hierarchical grid using WaveletImagePlot:

Out[2]=2

Image wavelet coefficients lie outside the valid range of ImageType:

"ImageFunction"->Identity gives an unnormalized image wavelet coefficient:

The color channels lie outside its valid 0 to 1 range:

Out[5]=5

By default, "ImageFunction"->ImageAdjust is used to normalize coefficients:

The color channels are now within the valid 0 to 1 range:

Out[8]=8

Sound Data  (3)

Transform a Sound object:

Out[1]=1
Out[2]=2

The inverse transform yields a reconstructed Sound object:

Out[3]=3

By default, coefficients are given as lists of data for each sound channel:

Out[2]=2

Get the {0,1} coefficient as a Sound object:

Out[3]=3

Inverse transform of {0,0,1} coefficient as a Sound object:

Out[4]=4

Browse all coefficients using a MenuView:

Out[2]=2

Generalizations & Extensions  (3)Generalized and extended use cases

DiscreteWaveletTransform works on arrays of symbolic quantities:

Out[2]=2

Inverse transform recovers the input exactly:

Out[3]=3

Specify any internal working precision:

Out[2]=2

Use complex-valued data:

Out[2]=2

The wavelet coefficients are complex:

Out[3]=3

Inverse transform recovers the input:

Out[4]=4

Options  (5)Common values & functionality for each option

Padding  (2)

The settings for Padding are the same as the methods for ArrayPad, including "Periodic":

Out[1]=1

"Reversed":

Out[2]=2

"ReversedNegation":

Out[3]=3

"Reflected":

Out[4]=4

"ReflectedDifferences":

Out[5]=5

"ReversedDifferences":

Out[6]=6

"Extrapolated":

Out[7]=7

Padding can remove boundary effects:

Out[2]=2

Using the default "Periodic" padding:

Out[4]=4

Using "Extrapolated" padding has fewer boundary effects for nonperiodic data:

Out[6]=6

WorkingPrecision  (3)

By default, WorkingPrecision->MachinePrecision is used:

Out[2]=2
Out[3]=3
Out[4]=4

Use higher-precision computation:

Out[2]=2

With numbers close to zero, accuracy is the better indicator of the number of correct digits:

Out[3]=3

Use WorkingPrecision-> for exact computation:

Out[2]=2

Applications  (11)Sample problems that can be solved with this function

Wavelet Compression  (1)

Compress data by finding a representation with few nonzero coefficients:

Out[2]=2

SymletWavelet[n] has n vanishing moments and represents polynomials of degree n:

Count counts the number of wavelet coefficients close to 0:

Out[4]=4

Detect Discontinuities and Edges  (2)

Visualize discontinuities in the wavelet domain:

Out[2]=2

Detail coefficients in the region of discontinuities have larger values:

Out[4]=4

Detect edges in an image:

Out[2]=2

Set coarse coefficients to 0 and reconstruct using detail coefficients only:

Out[4]=4

Energy Comparison  (1)

Compare the cumulative energy in a signal, its wavelet coefficients, and Fourier coefficients:

Out[2]=2

Compute the ordered cumulative energy in the signal:

Out[4]=4

Compute wavelet coefficients and Fourier coefficients:

The DWT captures more energy with fewer coefficients than the DFT:

Out[7]=7

Denoising  (3)

Perform energy-dependent thresholding:

Out[2]=2

Computing the fraction of energy contained at each refinement level:

Out[4]=4

Set wavelet coefficients containing less than 1% energy to zero:

Out[7]=7

Perform an amplitude-dependent thresholding:

Out[2]=2

Use WaveletThreshold to perform "Universal" thresholding:

Out[5]=5

Use Stein's unbiased risk estimator smoothing:

Out[7]=7

Denoise an Image:

Perform "Soft" thresholding with threshold value "SURE" computed adaptively at each level:

Invert thresholded coefficients:

Out[4]=4

Frequency Filtering  (1)

Wavelet transforms can be used to filter frequencies:

Out[3]=3

To filter out the two signals, first perform a wavelet transform:

Use WaveletListPlot to visualize frequency distribution:

Out[5]=5

To filter low frequencies, keep only the coarse coefficients:

Out[7]=7

To filter high frequencies, keep only the detail coefficients:

Out[9]=9

Finance  (3)

Extract the stock price trend for IBM since January 1, 2000:

Out[2]=2

The trend of the series is captured in the lowpass filter coefficients:

Out[4]=4

Thresholding all detail coefficients and inverting the series gives the trend:

Out[6]=6

Detrend a financial series:

Out[2]=2
Out[3]=3

Detail coefficients captured the detrended series:

Out[4]=4

Remove the trend by removing the coarse coefficients and inverting:

Out[6]=6

Study variance of returns in a financial time series:

Out[2]=2

Perform a wavelet transform using HaarWavelet and SymletWavelet:

Since the GE return series does not exhibit low-frequency oscillations, higher-scale detail coefficients do not indicate large variations from zero:

Out[4]=4

Although both filters will capture the variance of the series, they distribute it differently because of their approximate bandpass properties:

SymletWavelet isolates features in a certain frequency interval better than HaarWavelet:

Out[7]=7

Properties & Relations  (15)Properties of the function, and connections to other functions

DiscreteWaveletPacketTransform computes the full tree of wavelet coefficients:

Out[2]=2

DiscreteWaveletTransform computes a subset of the full tree of coefficients:

Out[4]=4

DiscreteWaveletTransform coefficients halve in length with each level of refinement:

Out[1]=1

Rotated data gives different coefficients:

Out[2]=2

StationaryWaveletTransform coefficients have the same length as the original data:

Out[3]=3

Rotated data gives rotated coefficients:

Out[4]=4

Multidimensional discrete wavelet transform is related to one-dimensional packet transform:

Out[2]=2
Out[4]=4

For Haar wavelet (default) and data length , the computed coefficients are identical:

Out[5]=5

The default refinement is given by TemplateBox[{{{InterpretationBox[{log, _, DocumentationBuild`Utils`Private`Parenth[2]}, Log2, AutoDelete -> True], (, n, )}, +, {1, /, 2}}}, Floor]:

Out[2]=2
Out[3]=3

In higher dimensions:

Out[5]=5
Out[6]=6

The energy norm is conserved for orthogonal wavelet families:

Out[3]=3

The energy norm is approximately conserved for biorthogonal wavelet families:

Out[3]=3
Out[4]=4

The mean of the data is captured at the maximum refinement level of the transform:

Extract the coefficient for the maximum refinement level:

Out[3]=3
Out[4]=4

Compensate for the normalization at each refinement level:

Out[5]=5
Out[6]=6

The sum of inverse transforms from individual coefficient arrays gives the original data:

Out[1]=1
Out[3]=3

Individually inverse transform each wavelet coefficient array:

Out[4]=4
Out[5]=5
Out[6]=6

The sum gives the original data:

Out[7]=7

Compute discrete wavelet coefficients for periodic data:

Define filter coefficients to have compact support:

Coarse coefficients at level are given by , with :

Out[8]=8

Detail coefficients at level are given by :

Out[11]=11

Compute a partial discrete inverse wavelet transform:

Define filter coefficients to have compact support:

Coarse coefficients at level are given:

Detail coefficients at level are given:

Inverse wavelet transform at level is given by :

Reconstruct coarse coefficients {0,0} at refinement level :

Out[12]=12

Reconstruct coarse coefficients {0} at refinement level :

Out[13]=13

Compute the dimensions of wavelet coefficients:

At refinement level , the dimensions of wavelet coefficients are given by wd_(j+1)=TemplateBox[{{{1, /, 2},  , {(, {{wd, _, j}, +, fl, -, 2}, )}}}, Ceiling], where represents dimensions of input data:

Compare dimensions with coefficient dimensions in dwd:

Out[5]=5
Out[6]=6

Compute a Haar discrete wavelet transform in one dimension:

Compute {0} and {1} wavelet coefficients:

Out[3]=3

Compare with DiscreteWaveletTransform:

Out[4]=4

In two dimensions, a separate filter is applied in each dimension:

Lowpass and highpass filters for Haar wavelet:

Haar wavelet transform of matrix data:

Out[4]=4

Compare with DiscreteWaveletTransform using HaarWavelet:

Out[6]=6

Image channels are transformed individually:

Out[1]=1

Combine {0} coefficients of separately transformed image channels:

Out[2]=2

Compare with {0} coefficient of DiscreteWaveletTransform of the original image:

Out[4]=4

The images are identical:

Out[5]=5

DWT is similar to LiftingWaveletTransform with extra coefficients needed for padding:

Out[3]=3
Out[4]=4

Possible Issues  (1)Common pitfalls and unexpected behavior

Padding can affect the total energy of wavelet coefficients:

Energy is not conserved:

Out[3]=3

Pad with 0s to ensure energy conservation in the coefficients:

Out[5]=5

Neat Examples  (1)Surprising or curious use cases

Create a padded matrix of data:

Out[2]=2

Create a 3D plot of the Haar DWT coefficients:

Out[4]=4
Wolfram Research (2010), DiscreteWaveletTransform, Wolfram Language function, https://reference.wolfram.com/language/ref/DiscreteWaveletTransform.html (updated 2017).
Copy to clipboard.
Wolfram Research (2010), DiscreteWaveletTransform, Wolfram Language function, https://reference.wolfram.com/language/ref/DiscreteWaveletTransform.html (updated 2017).

Text

Wolfram Research (2010), DiscreteWaveletTransform, Wolfram Language function, https://reference.wolfram.com/language/ref/DiscreteWaveletTransform.html (updated 2017).

Copy to clipboard.
Wolfram Research (2010), DiscreteWaveletTransform, Wolfram Language function, https://reference.wolfram.com/language/ref/DiscreteWaveletTransform.html (updated 2017).

CMS

Wolfram Language. 2010. "DiscreteWaveletTransform." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/DiscreteWaveletTransform.html.

Copy to clipboard.
Wolfram Language. 2010. "DiscreteWaveletTransform." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/DiscreteWaveletTransform.html.

APA

Wolfram Language. (2010). DiscreteWaveletTransform. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DiscreteWaveletTransform.html

Copy to clipboard.
Wolfram Language. (2010). DiscreteWaveletTransform. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DiscreteWaveletTransform.html

BibTeX

@misc{reference.wolfram_2025_discretewavelettransform, author="Wolfram Research", title="{DiscreteWaveletTransform}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/DiscreteWaveletTransform.html}", note=[Accessed: 05-April-2025 ]}

Copy to clipboard.
@misc{reference.wolfram_2025_discretewavelettransform, author="Wolfram Research", title="{DiscreteWaveletTransform}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/DiscreteWaveletTransform.html}", note=[Accessed: 05-April-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_discretewavelettransform, organization={Wolfram Research}, title={DiscreteWaveletTransform}, year={2017}, url={https://reference.wolfram.com/language/ref/DiscreteWaveletTransform.html}, note=[Accessed: 05-April-2025 ]}

Copy to clipboard.
@online{reference.wolfram_2025_discretewavelettransform, organization={Wolfram Research}, title={DiscreteWaveletTransform}, year={2017}, url={https://reference.wolfram.com/language/ref/DiscreteWaveletTransform.html}, note=[Accessed: 05-April-2025 ]}