DiscreteWaveletTransform - Maple Help

DiscreteTransforms

 DiscreteWaveletTransform
 compute the discrete wavelet transform of data

 Calling Sequence 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)

Parameters

 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

Options

 • 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.

Description

 • 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, Wavelet, WaveletParams)
 is equivalent to
 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.

Examples

 > $\mathrm{with}\left(\mathrm{DiscreteTransforms}\right)$
 $\left[{\mathrm{DiscreteWaveletTransform}}{,}{\mathrm{FourierTransform}}{,}{\mathrm{InverseDiscreteWaveletTransform}}{,}{\mathrm{InverseFourierTransform}}{,}{\mathrm{WaveletCoefficients}}{,}{\mathrm{WaveletPlot}}\right]$ (1)

Here are some small transforms using an artificial filter, to make clear the different options.

 > $\mathrm{w1}≔\mathrm{Vector}\left(\left[1,0,0\right],\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${\mathrm{w1}}{≔}\left[\begin{array}{c}{1.}\\ {0.}\\ {0.}\end{array}\right]$ (2)
 > $\mathrm{w2}≔\mathrm{Vector}\left(\left[0,0,1\right],\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${\mathrm{w2}}{≔}\left[\begin{array}{c}{0.}\\ {0.}\\ {1.}\end{array}\right]$ (3)
 > $A≔\mathrm{Vector}\left(6,i↦i,\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${A}{≔}\left[\begin{array}{c}{1.}\\ {2.}\\ {3.}\\ {4.}\\ {5.}\\ {6.}\end{array}\right]$ (4)
 > $\mathrm{DiscreteWaveletTransform}\left(A,\mathrm{w1},\mathrm{w2}\right)$
 $\left[\begin{array}{c}{1.}\\ {3.}\\ {5.}\end{array}\right]{,}\left[\begin{array}{c}{3.}\\ {5.}\\ {1.}\end{array}\right]$ (5)
 > $\mathrm{DiscreteWaveletTransform}\left(A,\mathrm{w1},\mathrm{w2},\mathrm{endconditions}=\mathrm{zeros}\right)$
 $\left[\begin{array}{c}{1.}\\ {3.}\\ {5.}\end{array}\right]{,}\left[\begin{array}{c}{3.}\\ {5.}\\ {0.}\end{array}\right]$ (6)
 > $\mathrm{DiscreteWaveletTransform}\left(A,\mathrm{w1},\mathrm{w2},\mathrm{endconditions}=\mathrm{reflection}\right)$
 $\left[\begin{array}{c}{1.}\\ {3.}\\ {5.}\end{array}\right]{,}\left[\begin{array}{c}{3.}\\ {5.}\\ {5.}\end{array}\right]$ (7)
 > $\mathrm{DiscreteWaveletTransform}\left(A,\mathrm{w1},\mathrm{w2},\mathrm{storagetype}=\mathrm{nodownsample}\right)$
 $\left[\begin{array}{c}{1.}\\ {2.}\\ {3.}\\ {4.}\\ {5.}\\ {6.}\end{array}\right]{,}\left[\begin{array}{c}{3.}\\ {4.}\\ {5.}\\ {6.}\\ {1.}\\ {2.}\end{array}\right]$ (8)
 > $\mathrm{DiscreteWaveletTransform}\left(A,\mathrm{w1},\mathrm{w2},\mathrm{storagetype}=\mathrm{singlearray}\right)$
 $\left[\begin{array}{c}{1.}\\ {3.}\\ {5.}\\ {3.}\\ {5.}\\ {1.}\end{array}\right]$ (9)

Inversion is not always possible with orthogonal or biorthogonal data. This is illustrated below.

 > $\mathrm{Digits}≔20:$
 > $\mathrm{w1},\mathrm{w2}≔\mathrm{WaveletCoefficients}\left("Daubechies",4\right):$
 > $\mathrm{Aprime}≔\mathrm{Vector}\left(A\right):$
 > $\mathrm{Aprime}\left[1\right]≔A\left[1\right]-1$
 ${{\mathrm{Aprime}}}_{{1}}{≔}{0.}$ (10)
 > $\mathrm{Aprime}\left[2\right]≔A\left[2\right]+\frac{1\mathrm{w1}\left[1\right]}{\mathrm{w1}\left[2\right]}:$
 > $\mathrm{Aprime}$
 $\left[\begin{array}{c}{0.}\\ {2.57735026918962573}\\ {3.}\\ {4.}\\ {5.}\\ {6.}\end{array}\right]$ (11)
 > $\mathrm{A1}≔\mathrm{Vector}\left(3,\mathrm{datatype}=\mathrm{float}\left[8\right]\right):$
 > $\mathrm{A2}≔\mathrm{Vector}\left(3,\mathrm{datatype}=\mathrm{float}\left[8\right]\right):$
 > $\mathrm{A1prime}≔\mathrm{Vector}\left(3,\mathrm{datatype}=\mathrm{float}\left[8\right]\right):$
 > $\mathrm{A2prime}≔\mathrm{Vector}\left(3,\mathrm{datatype}=\mathrm{float}\left[8\right]\right):$
 > $\mathrm{DiscreteWaveletTransform}\left(A,\mathrm{Daubechies},4,\mathrm{A1},\mathrm{A2},\mathrm{endconditions}=\mathrm{zeros}\right):$
 > $\mathrm{DiscreteWaveletTransform}\left(\mathrm{Aprime},\mathrm{Daubechies},4,\mathrm{A1prime},\mathrm{A2prime},\mathrm{endconditions}=\mathrm{zeros}\right):$
 > $\mathrm{A1}-\mathrm{A1prime}$
 $\left[\begin{array}{c}{0.}\\ {0.}\\ {0.}\end{array}\right]$ (12)
 > $\mathrm{A2}-\mathrm{A2prime}$
 $\left[\begin{array}{c}{0.}\\ {0.}\\ {0.}\end{array}\right]$ (13)
 > $\mathrm{DiscreteWaveletTransform}\left(A,\mathrm{Daubechies},4,\mathrm{A1},\mathrm{A2},\mathrm{endconditions}=\mathrm{reflection}\right):$
 > $\mathrm{DiscreteWaveletTransform}\left(\mathrm{Aprime},\mathrm{Daubechies},4,\mathrm{A1prime},\mathrm{A2prime},\mathrm{endconditions}=\mathrm{reflection}\right):$
 > $\mathrm{A1}-\mathrm{A1prime}$
 $\left[\begin{array}{c}{0.}\\ {0.}\\ {0.}\end{array}\right]$ (14)
 > $\mathrm{A2}-\mathrm{A2prime}$
 $\left[\begin{array}{c}{0.}\\ {0.}\\ {0.}\end{array}\right]$ (15)

See InverseDiscreteWaveletTransform for an example using n and m.