DiscreteTransforms
DiscreteWaveletTransform
compute the discrete wavelet transform of data
Calling Sequence
Parameters
Options
Description
Examples
DiscreteWaveletTransform(A, w1, w2)
DiscreteWaveletTransform(A, w1, w2, options)
DiscreteWaveletTransform(A, Wavelet, WaveletParams, options)
DiscreteWaveletTransform(n, A, dim, w1, A1, A2, options)
DiscreteWaveletTransform(n, m, A, dim, w1, A1, A2, options)
DiscreteWaveletTransform(n, A, dim, Wavelet, WaveletParams, A1, A2, options)
DiscreteWaveletTransform(n, m, A, dim, Wavelet, WaveletParams, A1, A2, options)
A
-
Vector, Matrix, or Array of datatype=float[8]; the data to be transformed
w1, w2
Vectors of datatype=float[8] of the same length; the high and low pass filters
Wavelet
string or name; the name of a supported wavelet family
WaveletParams
positive integer or list of two positive integers; the parameters to the family Wavelet
n
(optional) positive integer; the number of data points to be transformed
dim
(optional) integer; the dimension to be transformed in A, if A has more than one dimension
A1, A2
(optional) Vector, Matrix, or Array of datatype=float[8]; outputs in which to store the transformed data
m
(optional) positive integer; the number of transforms to be done
options
(optional) equation(s) of the form keyword = value, where keyword is endconditions or storagetype
endconditions can be periodic, zeros, or reflection.
endconditions determines how data will be generated to deal with convolutions near the end of the signal. If endconditions=zeros, the signal will be padded with zeros. If endconditions=reflection, the data will be reflected about the final term to generate new data. If endconditions=periodic, then it will be assumed that the data is periodic.
Warning: With almost all orthogonal and biorthogonal wavelets, DiscreteWaveletTransform can only be inverted with endconditions=periodic.
The default value of this option is endconditions=periodic.
storagetype can be standard, singlearray, or nodownsample.
If storagetype=standard, the standard discrete wavelet transform is performed on A. The result is stored in A1 and A2 (A1 and A2 are created if they are not provided), and then A1 and A2 are returned. A1 and A2 store the high and low pass coefficients, respectively.
If storagetype=singlearray, the discrete wavelet transform is performed on A and the results are stored side by side in A1 (A1 is created if it has not been provided), and then A1 is returned.
If storagetype=nodownsample, then a modified version of the discrete wavelet transform, with no down sampling, is performed on A. The result is stored in A1 and A2 (A1 and A2 are created if they have not been provided), and then A1 and A2 are returned.
Note that in the case of storagetype=standard, if A1 and A2 are provided, they must be at least as big as A in all dimensions except for dim, and must be at least half the size of A in dimension dim. In the case of storagetype=singlearray , if A1 is provided it must be at least as big as A in all dimensions. And in the case of storagetype=nodownsample, A1 and A2 must each be at least as big as A in all dimensions, if they are provided.
If storagetype is standard or nodownsample, then both A1 and A2 must be provided, or neither; it is not possible to provide only one.
The default value for this option is storagetype=standard.
The DiscreteWaveletTransform command performs the discrete wavelet transform on the signal A. If A1 and A2 (or just A1 when storagetype=singlearray) are provided, the transformed data is stored in them and they are returned. Otherwise, A1 and A2 are created before they are returned.
If A1 and A2 are not provided, they are created to be of the same type, and have the same options, as A.
If provided, Wavelet and WaveletParams must be supported by WaveletCoefficients.
If Wavelet is an orthogonal family, then
DiscreteWaveletTransform(A, Wavelet, WaveletParams)
is equivalent to
DiscreteWaveletTransform(A, WaveletCoefficients(Wavelet,WaveletParams))
If Wavelet is a biorthogonal family, then
DiscreteWaveletTransform(A, op(1..2,[WaveletCoefficients(Wavelet,op(WaveletParams))]))
DiscreteWaveletTransform will only transform data of even length, so if n is provided, it must be even; if n is not provided, then A must have an even size in dimension dim.
m can only be specified if n is also provided and A has dimension 2. In this case, only m rows or columns (depending on which dimension is being transformed) are transformed, instead of all of them.
If A has more than one dimension, dim must be provided.
Note: Currently, only Arrays of 1 or 2 dimensions can be transformed.
with⁡DiscreteTransforms
DiscreteWaveletTransform,FourierTransform,InverseDiscreteWaveletTransform,InverseFourierTransform,WaveletCoefficients,WaveletPlot
Here are some small transforms using an artificial filter, to make clear the different options.
w1≔Vector⁡1,0,0,datatype=float8
w1≔1.0.0.
w2≔Vector⁡0,0,1,datatype=float8
w2≔0.0.1.
A≔Vector⁡6,i↦i,datatype=float8
A≔1.2.3.4.5.6.
DiscreteWaveletTransform⁡A,w1,w2
1.3.5.,3.5.1.
DiscreteWaveletTransform⁡A,w1,w2,endconditions=zeros
1.3.5.,3.5.0.
DiscreteWaveletTransform⁡A,w1,w2,endconditions=reflection
1.3.5.,3.5.5.
DiscreteWaveletTransform⁡A,w1,w2,storagetype=nodownsample
1.2.3.4.5.6.,3.4.5.6.1.2.
DiscreteWaveletTransform⁡A,w1,w2,storagetype=singlearray
1.3.5.3.5.1.
Inversion is not always possible with orthogonal or biorthogonal data. This is illustrated below.
Digits≔20:
w1,w2≔WaveletCoefficients⁡Daubechies,4:
Aprime≔Vector⁡A:
Aprime1≔A1−1
Aprime1≔0.
Aprime2≔A2+1⁢w11w12:
Aprime
0.2.577350269189625733.4.5.6.
A1≔Vector⁡3,datatype=float8:
A2≔Vector⁡3,datatype=float8:
A1prime≔Vector⁡3,datatype=float8:
A2prime≔Vector⁡3,datatype=float8:
DiscreteWaveletTransform⁡A,Daubechies,4,A1,A2,endconditions=zeros:
DiscreteWaveletTransform⁡Aprime,Daubechies,4,A1prime,A2prime,endconditions=zeros:
A1−A1prime
0.0.0.
A2−A2prime
DiscreteWaveletTransform⁡A,Daubechies,4,A1,A2,endconditions=reflection:
DiscreteWaveletTransform⁡Aprime,Daubechies,4,A1prime,A2prime,endconditions=reflection:
See InverseDiscreteWaveletTransform for an example using n and m.
See Also
InverseDiscreteWaveletTransform
SignalProcessing[DWT]
Wavelet Examples and Applications
WaveletCoefficients
WaveletPlot
Wavelets
Download Help Document