Main Content

mswcmpscr

Multisignal 1-D wavelet compression scores

    Description

    [thr,l2scr,n0scr,idxsort] = mswcmpscr(dec) returns the thresholds thr, compression scores l2scr and n0scr, and indices idxsort for the wavelet decomposition dec.

    [___] = mswcmpscr(___,s_or_h) applies the threshold rule specified by s_or_h.

    example

    [___] = mswcmpscr(___,s_or_h,keepapp) either keeps the approximation coefficients (true) or does not (false).

    [___] = mswcmpscr(___,s_or_h,keepapp,idxsig) is a vector which contains the indices of the initial signals.

    Examples

    collapse all

    Load the 23 channel EEG data Espiga3 [4]. 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]}
    
    

    Compute the compression performances for soft and hard thresholding.

    [thr_s,l2scr_s,n0scr_s] = mswcmpscr(dec,"s");
    [thr_h,l2scr_h,n0scr_h] = mswcmpscr(dec,"h");

    Input Arguments

    collapse all

    Wavelet decomposition, specified as a structure. dec is the output of mdwtdec and has these 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 coefficients ca and cd{k}, for k from 1 to lev, are matrices and are stored in rows if dirdec is "r" or in columns if dirdec is "c".

    The decomposition dec corresponds to a matrix of wavelet coefficients cfs obtained by concatenation of detail and (optionally) approximation coefficients, where cfs is either [cd{dec.level}, ... , cd{1}] or [ca, cd{dec.level}, ... , cd{1}]. The concatenation is made row-wise if dec.dirDec is equal to "r" or column-wise if dec.dirDec is equal to "c".

    If NbSIG is the number of original signals and NbCFS the number of coefficients for each signal (all or only the detail coefficients), then cfs is an NbSIG-by-NbCFS matrix.

    Type of thresholding to perform, specified as either of the following:

    • "s" — Soft thresholding

    • "h" — Hard thresholding

    For more information, see mswthresh.

    Approximation coefficients option, specified as a numeric or logical 1 (true) or 0 (false).

    • 0 — Do not keep the approximation coefficients

    • 1 — Keep the approximation coefficients

    Indices of initial signals, specified as a vector of positive integers, or "all".

    Output Arguments

    collapse all

    Thresholds, returned as an NbSIG-by-(NbCFS+1) matrix, where NbSIG is the number of original signals and NbCFS the number of coefficients for each signal (all or only the detail coefficients).

    thr(:,2:end) is equal to cfs sorted by row in ascending order with respect to the absolute value, and thr(:,1)=0.

    Compression scores, returned as NbSIG-by-(NbCFS+1) matrices. For the ith original signal:

    • l2scr(i,j) is the percentage of preserved energy (L2-norm), corresponding to a threshold equal to cfs(i,j-1) for 2jNbCFS, and l2scr(:,1)=100.

    • n0scr(i,j) is the percentage of zeros corresponding to a threshold equal to cfs(i,j-1) for 2jNbCFS, and n0scr(:,1)=0.

    Order of coefficients, returned as a NbSIG-by-NbCFS matrix. For each row, idxsort contains the order of coefficients.

    References

    [1] Daubechies, I. Ten Lectures on Wavelets, CBMS-NSF Regional Conference Series in Applied Mathematics. Philadelphia, PA: SIAM Ed, 1992.

    [2] Mallat, S.G. “A Theory for Multiresolution Signal Decomposition: The Wavelet Representation.” IEEE Transactions on Pattern Analysis and Machine Intelligence 11, no. 7 (July 1989): 674–93. https://doi.org/10.1109/34.192463.

    [3] Meyer, Y. Wavelets and Operators. Translated by D. H. Salinger. Cambridge, UK: Cambridge University Press, 1995.

    [4] 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