# Documentation

### This is machine translation

Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.

# mswcmp

Multisignal 1-D compression using wavelets

## Syntax

```[XC,DECCMP,THRESH] = mswcmp('cmp',DEC,METH)[XC,DECCMP,THRESH] = mswcmp('cmp',DEC,METH,PARAM)[XC,THRESH] = mswcmp('cmpsig',...)[DECCMP,THRESH] = mswcmp('cmpdec',...)THRESH = mswcmp('thr',...) [...] = mswcmp(OPTION,DIRDEC,X,WNAME,LEV,METH) [...] = mswcmp(OPTION,DIRDEC,X,WNAME,LEV,METH,PARAM) [...] = mswcmp(...,S_OR_H) [...] = mswcmp(...,S_OR_H,KEEPAPP) [...] = mswcmp(...,S_OR_H,KEEPAPP,IDXSIG) ```

## Description

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

 `'rem_n0'` Remove near 0 `'bal_sn'` Balance sparsity-norm `'sqrtbal_sn'` Balance sparsity-norm (`sqrt`) `'scarce'` Scarce, `PARAM` (any number) `'scarcehi'` Scarce high, `2.5` ≤ `PARAM` ≤ `10` `'scarceme'` Scarce medium, `1.5` ≤ `PARAM` ≤ `2.5` `'scarcelo'` Scarce low, `1` ≤ `PARAM` ≤ `2`

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

 `'L2_perf'` Energy ratio `'N0_perf'` Zero coefficients ratio

`PARAM` is a real number which represents the required performance:

`0``PARAM``100`.

 `'glb_thr'` Global threshold

`PARAM` is a real positive number.

 `'man_thr'` 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 (`1``j``NbLEV`).

• - `PARAM(i,NbLEV+1)` is the threshold for the approximation coefficients for the `i`th 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.

`[...] = mswcmp(OPTION,DIRDEC,X,WNAME,LEV,METH) [...] = mswcmp(OPTION,DIRDEC,X,WNAME,LEV,METH,PARAM) ` 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'`.

## Examples

```% 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. figure; 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') ```

## References

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.