Main Content


Multisignal 1-D compression thresholds and performances


[THR_VAL,L2_Perf,N0_Perf] = mswcmptp(DEC,METH)
[THR_VAL,L2_Perf,N0_Perf] = mswcmptp(DEC,METH,PARAM)


[THR_VAL,L2_Perf,N0_Perf] = mswcmptp(DEC,METH) or [THR_VAL,L2_Perf,N0_Perf] = mswcmptp(DEC,METH,PARAM) computes the vectors THR_VAL, L2_Perf and N0_Perf obtained after a compression using the METH method and, if required, the PARAM parameter (see mswcmp for more information on METH and PARAM).

For the ith signal:

  • THR_VAL(i) is the threshold applied to the wavelet coefficients. For a level dependent method, THR_VAL(i,j) is the threshold applied to the detail coefficients at level j

  • L2_Perf(i) is the percentage of energy (L2_norm) preserved after compression.

  • N0_Perf(i) is the percentage of zeros obtained after compression.

You can use three more optional inputs:

[...] = mswcmptp(...,S_OR_H,KEEPAPP,IDXSIG)

  • S_OR_H ('s' or 'h') stands for soft or hard thresholding (see mswthresh for more details).

  • KEEPAPP (true or false) indicates whether to keep approximation coefficients (true) or not (false)

  • IDXSIG is a vector which contains the indices of the initial signals, or 'all'.

The defaults are, respectively, 'h', false and 'all'.


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: [1x1 struct]
       dwtEXTM: 'sym'
      dwtShift: 0
      dataSize: [995 23]
            ca: [251x23 double]
            cd: {[499x23 double]  [251x23 double]}

Compute compression thresholds and exact performances obtained after a compression using the method 'N0_perf' and requiring a percentage of zeros near 95% for the wavelet coefficients.

[THR_VAL,L2_Perf,N0_Perf] = mswcmptp(dec,'N0_perf',95);


[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. Vol. 11, Issue 7, July 1989, pp. 674–693.

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

Version History

Introduced in R2007a