Main Content

lwt

1-D lifting wavelet transform

Since R2021a

    Description

    [ca,cd] = lwt(x) returns the wavelet decomposition of x. lwt uses the lifting scheme associated with the db1 wavelet and does not preserve integer-valued data. x is a vector or matrix. If x is a matrix, lwt operates along the first dimension of x. x must have at least two samples. If x is of even length, the wavelet transform is obtained down to level floor(log2(N)), where N is the length of x if x is a vector, and the row dimension of x if x is a matrix. If N is odd, x is extended by one sample by duplicating the last element of x.

    example

    [ca,cd] = lwt(___,Name,Value) specifies options using one or more name-value arguments. For example, [ca,cd] = lwt(x,'Level',2) specifies a level 2 wavelet decomposition.

    Examples

    collapse all

    Specify an integer-valued signal. Create a lifting scheme associated with the db2 wavelet.

    sig = 1:10;
    lsc = liftingScheme('Wavelet','db2');

    Obtain the level 2 lifting wavelet transform (LWT) using the lifting scheme. Display the approximation and detail coefficients.

    wv = 'db2';
    [ca,cd] = lwt(sig,'LiftingScheme',lsc,'Level',2);
    ca
    ca = 3×1
    
        5.8038
       14.0801
       16.5801
    
    
    cd{1}
    ans = 5×1
    
        3.5355
             0
        0.0000
        0.0000
        0.0000
    
    
    cd{2}
    ans = 3×1
    
        5.0311
       -0.0000
       -1.0311
    
    

    Obtain the decomposition again, but this time preserve the integer-valued data.

    [ca,cd] = lwt(sig,'LiftingScheme',lsc,'Level',2,'Int2Int',true);
    ca
    ca = 3×1
    
         2
         4
         4
    
    
    cd{1}
    ans = 5×1
    
         6
         0
         0
         0
         0
    
    
    cd{2}
    ans = 3×1
    
         5
         1
         0
    
    

    Load the 23 channel EEG data Espiga3. The channels are arranged column-wise.

    load Espiga3
    size(Espiga3)
    ans = 1×2
    
       995    23
    
    

    Obtain the LWT of the multichannel signal using the db4 wavelet down to the default maximum decomposition level.

    wv = 'db4';
    [ca,cd] = lwt(Espiga3,'Wavelet',wv);

    Confirm the number of columns in ca is equal to the number of channels in the multichannel signal, and that the detail coefficients are an N-by-1 cell array, where N is equal to floor(log2(size(Espiga3,1))).

    size(ca)
    ans = 1×2
    
         2    23
    
    
    floor(log2(size(Espiga3,1)))
    ans = 9
    
    size(cd) 
    ans = 1×2
    
         9     1
    
    

    Input Arguments

    collapse all

    Signal, specified as a vector or matrix. If x is a matrix, lwt operates along the first dimension of x. x must have at least two samples. If x has an odd number of samples, x is extended by one sample by duplicating the last element of x.

    Data Types: single | double
    Complex Number Support: Yes

    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.

    Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

    Example: [ca,cd] = lwt(x,'Wavelet','db3','Level',4) uses the db3 wavelet to perform a level 4 wavelet decomposition.

    Orthogonal or biorthogonal wavelet to use in the LWT, specified as a character vector or string scalar. See the Wavelet property of liftingScheme for the list of supported wavelets.

    You cannot specify 'Wavelet' and 'LiftingScheme' name-value arguments at the same time.

    Example: [ca,cd] = lwt(x,'Wavelet','bior3.5') uses the bior3.5 biorthogonal wavelet.

    Lifting scheme to use in the LWT, specified as a liftingScheme object.

    You cannot specify 'LiftingScheme' and 'Wavelet' name-value arguments at the same time.

    Example: [ca,cd] = lwt(x,'LiftingScheme',lScheme) uses the lScheme lifting scheme.

    Level of wavelet decomposition, specified as a positive integer less than or equal to floor(log2(N)), where N is the length of x if x is a vector, or the row dimension of x if x is a matrix.

    Example: [ca,cd] = lwt(x,'Level',4) specifies a level 4 wavelet decomposition.

    Data Types: double

    Extension mode to use in the LWT, specified as 'periodic' (default), 'zeropad', or 'symmetric'. The value of 'Extension' specifies how to extend the signal at the boundaries.

    Example: [ca,cd] = lwt(x,'Extension','symmetric') specifies the symmetric extension mode.

    Integer-valued data handling, specified as a numeric or logical 1 (true) or 0 (false).

    • 1 (true) — Preserve integer-valued data

    • 0 (false) — Do not preserve integer-valued data

    Specify the 'Int2Int' name-value argument only if all elements of the input are integers.

    Example: [ca,cd] = lwt(1:8,'Int2Int',true) preserves integer-valued data.

    Output Arguments

    collapse all

    Approximation (lowpass) coefficients at the coarsest level, returned as a scalar, vector, or matrix. The dimension of ca depends on the signal dimension.

    Data Types: single | double

    Detail coefficients, returned as an L-by-1 cell array, where L is the level of the transform. The elements of cd are in order of decreasing resolution.

    Data Types: single | double

    References

    [1] Strang, Gilbert, and Truong Nguyen. Wavelets and Filter Banks. Rev. ed. Wellesley, Mass: Wellesley-Cambridge Press, 1997.

    [2] Sweldens, Wim. “The Lifting Scheme: A Construction of Second Generation Wavelets.” SIAM Journal on Mathematical Analysis 29, no. 2 (March 1998): 511–46. https://doi.org/10.1137/S0036141095289051.

    Extended Capabilities

    C/C++ Code Generation
    Generate C and C++ code using MATLAB® Coder™.

    Version History

    Introduced in R2021a

    expand all