Main Content

dlmodwt

Deep learning maximal overlap discrete wavelet transform and multiresolution analysis

Since R2022a

    Description

    w = dlmodwt(x) returns the maximal overlap discrete wavelet transform (MODWT) of x using the lowpass (scaling) and highpass (wavelet) filters associated with the Daubechies least-asymmetric wavelet with four vanishing moments ("sym4"). By default, dlmodwt uses periodic boundary extension and computes the MODWT to the maximum level. dlmodwt requires Deep Learning Toolbox™.

    w = dlmodwt(x,Lo,Hi) uses the scaling filter Lo and wavelet filter Hi in the MODWT computation.

    w = dlmodwt(x,Lo,Hi,level) computes the MODWT down to the level specified in level.

    [w,mra] = dlmodwt(___) returns the multiresolution analysis (MRA) of the MODWT of x.

    example

    [___] = dlmodwt(___,Name=Value) specifies options using one or more name-value arguments in addition to the input arguments in previous syntaxes. For example, BOUNDARY="periodic" specifies periodic extension at the boundary.

    Examples

    collapse all

    Load the 23 channel Espiga3 EEG data set. The data is sampled at 200 Hz. There are 995 samples in each channel. The data set is arranged as a 995-by-23(-by-1) array.

    load Espiga3

    Store the signal in an unformatted deep learning array.

    x = dlarray(Espiga3);

    Obtain the MODWT and MRA of the data. Specify the data format as 'TCB'.

    [wt,mra] = dlmodwt(x,DataFormat='TCB');

    Confirm that both wt and mra are unformatted dlarray objects.

    whos wt mra
      Name       Size                    Bytes  Class      Attributes
    
      mra       10x23x1x995            1830800  dlarray              
      wt        10x23x1x995            1830800  dlarray              
    
    dims(wt)
    ans =
    
      0x0 empty char array
    
    dims(mra)
    ans =
    
      0x0 empty char array
    

    Plot the reconstruction based on the MRA. Compare with the original data set.

    xrec = sum(mra);
    subplot(2,1,1)
    plot(Espiga3)
    title("Original EEG Dataset")
    subplot(2,1,2)
    plot(extractdata(squeeze(xrec))')
    title("MODWT MRA Reconstruction")

    Input Arguments

    collapse all

    Input array, specified as an unformatted dlarray (Deep Learning Toolbox), a formatted dlarray in 'CBT' format, or a numeric array.

    If x is a numeric array or an unformatted dlarray, x must be compatible with the 'CBT' format. You must specify the 'DataFormat' as some permutation of 'CBT'. x must have at least two samples along the time dimension.

    Example: dlarray(cos(pi./[4;2]*(0:159)),'CTB') and dlarray(cos(pi./[4;2]*(0:159))','TCB') both specify one batch observation of a two-channel sinusoid in the 'CBT' format.

    Data Types: single | double
    Complex Number Support: Yes

    Filters used in the MODWT computation, specified as a pair of even-length real-valued numeric vectors or unformatted dlarray objects. Lo is the scaling (lowpass) filter, and Hi is the wavelet (highpass) filter.

    In order to satisfy the MODWT requirements, Lo and Hi must be the lowpass and highpass filters corresponding to an orthogonal wavelet. The wavelet manager wavemngr designates orthogonal wavelets as type 1 wavelets.

    Valid built-in orthogonal wavelet families are: Best-localized Daubechies ("bl"), Beylkin ("beyl"), Coiflets ("coif"), Daubechies ("db"), Fejér-Korovkin ("fk"), Haar ("haar"), Han linear-phase moments ("han"), Morris minimum-bandwidth ("mb"), Symlets ("sym"), and Vaidyanathan ("vaid"). For a list of wavelets in each family, see wfilters. You can also use waveinfo with the wavelet family short name. For example, waveinfo("db"). Use wavemngr("type",wn) to determine if the wavelet wn is orthogonal (returns 1). For example, wavemngr("type","db6") returns 1.

    If you have Lo and Hi as numeric vectors, you can use isorthwfb to determine orthogonality: [tf,checks] = isorthwfb(Lo,Hi).

    If unspecified, Lo and Hi default to: [~,~,Lo,Hi] = wfilters("sym4").

    Note

    You can specify a pair of empty inputs for Lo and Hi. In this case, the dlmodwt function uses the default filters. For example, dlmodwt(x,[],[]) is equivalent to dlmodwt(x). For more information, see Version History.

    Data Types: single | double

    Transform level of the MODWT, specified as a positive integer less than or equal to floor(log2(T)), where T is the size of x along the time dimension. If unspecified, dlmodwt computes the MODWT down to level floor(log2(T)).

    Data Types: single | double

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: w = dlmodwt(x,DataFormat='TCB') specifies the data format as 'TCB'.

    Extension method to apply at the boundary in the computation of the MODWT, specified as one of these:

    • "periodic" — Extend signal periodically

    • "reflection" — Extend signal by reflection. The function computes the MODWT using a reflected signal along the T dimension twice the original length of x. The MODWT transform coefficients are also twice the length of the input.

    Example: w = dlmodwt(x,DataFormat="TCB",BOUNDARY="reflection") extends the signal by reflection.

    Data format of input x, specified as some permutation of 'CBT'. This argument is valid only if x is unformatted.

    Each character in this argument must be one of these labels:

    • C — Channel

    • B — Batch

    • T — Time

    The dlmodwt function accepts any permutation of 'CBT'. Each element of the argument labels the matching dimension of x.

    Example: w = dlmodwt(x,DataFormat="BCT") specifies the data format of the unformatted dlarray object as "BCT".

    Data Types: char | string

    Output Arguments

    collapse all

    Maximal overlap discrete wavelet transform of x, returned as a 'SCBT' formatted dlarray. w contains the wavelet coefficients and final-level scaling coefficients of x. The MODWT partitions the energy of the signal across the various scales and scaling coefficients. For more information, see modwt.

    The size of w depends on the boundary extension method used in the computation of the MODWT.

    • If the signal is extended periodically, then w is level+1-by-C-by-B-by-T.

    • If the signal is extended by reflection, then w is level+1-by-C-by-B-by-2×T.

    level is the transform level of the MODWT. C and B correspond to the channel and batch dimensions, respectively. The kth row of w contains the wavelet coefficients for the kth level. The (level+1)th row of w contains the approximation coefficients.

    If you specify 'DataFormat', w is an unformatted dlarray.

    Multiresolution analysis of the MODWT of x, returned as a 'SCBT' formatted dlarray. mra contains the projections of x onto wavelet subspaces and a scaling space. For more information, see modwtmra.

    mra is level+1-by-C-by-B-by-T, where level is the transform level of the MODWT. The kth row of mra contains the details for the kth level. The (level+1)th row of mra contains the levelth level smooth.

    If you specify 'DataFormat', mra is an unformatted dlarray compatible with 'SCBT' format.

    To learn more about the differences between the MODWT and the MRA, see Comparing MODWT and MODWTMRA.

    Extended Capabilities

    Version History

    Introduced in R2022a

    expand all

    See Also

    Functions

    Objects