This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Multisignal 1-D compression using wavelets


[XC,DECCMP,THRESH] = mswcmp('cmp',DEC,METH)
[XC,THRESH] = mswcmp('cmpsig',...)
[DECCMP,THRESH] = mswcmp('cmpdec',...)
THRESH = mswcmp('thr',...)
[...] = mswcmp(...,S_OR_H)
[...] = mswcmp(...,S_OR_H,KEEPAPP)
[...] = mswcmp(...,S_OR_H,KEEPAPP,IDXSIG)


mswcmp computes thresholds and, depending on the selected option, performs compression of 1-D signals using wavelets.

[XC,DECCMP,THRESH] = mswcmp('cmp',DEC,METH) or
[XC,DECCMP,THRESH] = mswcmp('cmp',DEC,METH,PARAM) returns a compressed (indicated by 'cmp' input) version XC of the original multisignal matrix X, whose wavelet decomposition structure is DEC. The output XC is obtained by thresholding the wavelet coefficients: DECCMP, which is the wavelet decomposition associated with XC (see mdwtdec), and THRESH is the matrix of threshold values. The input METH is the name of the compression method and PARAM is the associated parameter, if required.

Valid compression methods METH are shown in the following tables. For methods that use an associated parameter, the range of allowable PARAM values is also shown.


Remove near 0


Balance sparsity-norm


Balance sparsity-norm (sqrt)


Scarce, PARAM (any number)


Scarce high, 2.5PARAM10


Scarce medium, 1.5PARAM2.5


Scarce low, 1PARAM2

PARAM is a sparsity parameter, and it should be such that: 1PARAM10. For scarce method no control is done.


Energy ratio


Zero coefficients ratio

PARAM is a real number which represents the required performance:



Global threshold

PARAM is a real positive number.


Manual method

PARAM is an NbSIG-by-NbLEV matrix or NbSIG-by-(NbLEV+1) matrix such that:

  • - PARAM(i,j) is the threshold for the detail coefficients of level j for the ith signal (1jNbLEV).

  • - PARAM(i,NbLEV+1) is the threshold for the approximation coefficients for the ith signal (if KEEPAPP is 0).

Where NbSIG is the number of signals and NbLEV the number of levels of decomposition.

[XC,THRESH] = mswcmp('cmpsig',...) or
[DECCMP,THRESH] = mswcmp('cmpdec',...) or
THRESH = mswcmp('thr',...) Instead of the 'cmp' input OPTION, you can use 'cmpsig', 'cmpdec' or 'thr' to select other output arguments. 'thr' returns the computed thresholds, but compression is not performed.

The decomposition structure input argument DEC can be replaced by four arguments: DIRDEC, X, WNAME, and LEV. Before performing a compression or computing thresholds, the multisignal matrix X is decomposed at level LEV using the wavelet WNAME, in the direction DIRDEC.

[...] = mswcmp(...,S_OR_H)
[...] = mswcmp(...,S_OR_H,KEEPAPP)
[...] = mswcmp(...,S_OR_H,KEEPAPP,IDXSIG)
Three more optional inputs may be used:

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

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

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


% Load original 1D-multisignal.
load thinker

% Perform a decomposition at level 2 using wavelet db2.
dec = mdwtdec('r',X,2,'db2');

% Compress the signals to obtain a percentage of zeros
% near 95% for the wavelet coefficients.
[XC,decCMP,THRESH] = mswcmp('cmp',dec,'N0_perf',95);
[Ecmp,PECcmp,PECFScmp] = wdecenergy(decCMP);

% Plot the original signals 1 and 31, and 
% the corresponding compressed signals.
plot(X([1 31],:)','r--','linewidth',2);   hold on
plot(XC([1 31],:)','b','linewidth',2);
grid; set(gca,'Xlim',[1,96])
title('X dashed line and XC solid line')


Birgé L.; P. Massart (1997), “From Model Selection to Adaptive Estimation,” in D. Pollard (ed), Festchrift for L. Le Cam, Springer, pp. 55–88.

DeVore, R.A.; B. Jawerth, B.J. Lucier (1992), “Image Compression Through Wavelet Transform Coding,” IEEE Trans. on Inf. Theory, vol. 38, No 2, pp. 719–746.

Donoho, D.L. (1993), “Progress in Wavelet Analysis and WVD: a Ten Minute Tour,” in Progress in Wavelet Analysis and Applications, Y. Meyer, S. Roques, pp. 109–128. Frontières Ed.

Donoho, D.L.; I.M. Johnstone(1994), “Ideal Spatial Adaptation by Wavelet Shrinkage,” Biometrika, vol. 81, pp. 425–455.

Donoho, D.L.; I.M. Johnstone, G. Kerkyacharian, D. Picard (1995), “Wavelet Shrinkage: Asymptopia,” Jour. Roy. Stat. Soc., series B, vol. 57 no. 2, pp. 301–369.

Donoho, D.L.; I.M. Johnstone, “Ideal De-noising in an Orthonormal Basis Chosen from a Library of Bases,” C.R.A.S. Paris, t. 319, Ser. I, pp. 1317–1322.

Donoho, D.L. (1995), “De-noising by Soft-thresholding,” IEEE Trans. on Inf. Theory, 41, 3, pp. 613–627.

Introduced in R2007a

Was this topic helpful?