Main Content

chgwdeccfs

Change multisignal 1-D decomposition coefficients

    Description

    decM = chgwdeccfs(dec,"ca",coeffs) replaces the approximation coefficients at level dec.level with those contained in coeffs.

    example

    decM = chgwdeccfs(dec,"cd",coeffs,lev) replaces the detail coefficients at level lev with those contained in coeffs.

    decM = chgwdeccfs(dec,"all",ca,cd) replaces all the approximation and detail coefficients with those contained in ca and cd, respectively.

    If V is a scalar, then chgwdeccfs(dec,"all",V,V) is equivalent to chgwdeccfs(dec,"all",V).

    decM = chgwdeccfs(___,idxsig) replaces the coefficients for the signals whose indices are specified by idxsig.

    Examples

    collapse all

    Load the 23 channel EEG data Espiga3 [1]. The channels are arranged column-wise. The data is sampled at 200 Hz.

    load Espiga3

    Perform a decomposition at level 2 using the db2 wavelet.

    dec = mdwtdec("c",Espiga3,2,"db2")
    dec = struct with fields:
            dirDec: 'c'
             level: 2
             wname: 'db2'
        dwtFilters: [1×1 struct]
           dwtEXTM: 'sym'
          dwtShift: 0
          dataSize: [995 23]
                ca: [251×23 double]
                cd: {[499×23 double]  [251×23 double]}
    
    

    Change the approximation coefficients of all the signals. Replace all the values with 2.

    decApp = chgwdeccfs(dec,"ca",2);

    Compare the original and new approximation coefficients.

    tiledlayout(1,2)
    nexttile
    plot(dec.ca)
    axis tight
    title("Original Coefficients")
    nexttile
    plot(decApp.ca)
    axis tight
    title("Modified Coefficients")

    Figure contains 2 axes objects. Axes object 1 with title Original Coefficients contains 23 objects of type line. Axes object 2 with title Modified Coefficients contains 23 objects of type line.

    Change the detail coefficients at level 1 and level 2 for channels 11 to 15. Replace all the values with 6.

    decTer = chgwdeccfs(dec,"cd",6,1:2,11:15);

    Compare the original and new coefficients for level 1 details.

    tiledlayout(1,2)
    nexttile
    plot(dec.cd{1}(:,11:15))
    axis tight
    title("Original Coefficients")
    nexttile
    plot(decTer.cd{1}(:,11:15))
    axis tight
    title("Modified Coefficients")

    Figure contains 2 axes objects. Axes object 1 with title Original Coefficients contains 5 objects of type line. Axes object 2 with title Modified Coefficients contains 5 objects of type line.

    Input Arguments

    collapse all

    Wavelet decomposition of a multisignal, specified as a structure with the following fields:

    • dirDec — Direction indicator: 'r' (row) or 'c' (column)

    • level — Level of wavelet decomposition

    • wname — Wavelet name

    • dwtFilters — Structure with four fields: LoD, HiD, LoR, and HiR

    • dwtEXTM — DWT extension mode

    • dwtShift — DWT shift parameter (0 or 1)

    • dataSize — Size of x

    • ca — Approximation coefficients at level lev

    • cd — Cell array of detail coefficients, from level 1 to level lev

    The format of dec matches the output of mdwtdec.

    Replacement coefficients, specified as a vector or matrix. If coeffs is a scalar, then all the coefficients are replaced with coeffs. Otherwise, coeffs must be a matrix whose size equals those of the coefficients you are replacing.

    Decomposition level, specified as a positive integer or vector of positive integers between 1 and dec.level. The length of the vector cannot exceed dec.level. If lev is an integer, then coeffs can be a scalar or matrix. If lev is a vector, then coeffs must be a scalar.

    If coeffs is a scalar:

    • All detail coefficients at the specified levels, lev, are replaced with coeffs.

    • The syntax chgwdeccfs(dec,"cd",coeffs) is equivalent to chgwdeccfs(dec,"cd",coeffs,1:dec.level).

    Replacement approximation coefficients, specified as a scalar or matrix. If ca is a scalar, all the approximation coefficients are replaced by ca. If ca is a matrix, then the size of ca must equal the size of the approximation coefficients you are replacing.

    Replacement detail coefficients, specified as a scalar or cell array of length dec.level. If cd is a scalar, then the detail coefficients at all levels are replaced with cd. If cd is a cell array, then the elements of cd can be a scalar or a matrix whose size matches the coefficients at the corresponding decomposition level.

    Signal indices, specified as a vector. The chgwdeccfs function replaces the coefficients of the specified signals. If the initial data is stored row-wise or column-wise in a matrix M, then idxsig contains the row or column indices, respectively, of the data.

    Output Arguments

    collapse all

    Wavelet decomposition, returned as a structure. The formats of decM and dec are identical.

    References

    [1] Mesa, Hector. “Adapted Wavelets for Pattern Detection.” In Progress in Pattern Recognition, Image Analysis and Applications, edited by Alberto Sanfeliu and Manuel Lazo Cortés, 3773:933–44. Berlin, Heidelberg: Springer Berlin Heidelberg, 2005. https://doi.org/10.1007/11578079_96.

    Version History

    Introduced in R2007a

    See Also

    |