Main Content

# mswden

(Not recommended) Multisignal 1-D denoising using wavelets

`mswden` is not recommended. Use `wdenoise` instead.

## Syntax

``[xd,decden,thresh] = mswden("den",dec,meth,param)``
``[xd,thresh] = mswden("densig",dec,meth,param)``
``[decden,thresh] = mswden("dendec",dec,meth,param)``
``thresh = mswden("thr",dec,meth,param)``
``[___] = mswden(option,dirdec,x,wname,lev,meth,param)``
``[___] = mswden(___,sorh)``
``[___] = mswden(___,sorh,keepapp)``
``[___] = mswden(___,sorh,keepapp,idxsig)``

## Description

`mswden` computes thresholds and, depending on the selected option, performs denoising of 1-D signals using wavelets.

example

````[xd,decden,thresh] = mswden("den",dec,meth,param)` returns a denoised version `xd` of the multisignal `x` whose wavelet decomposition is `dec`. `meth` is the name of the denoising method and `param` is the associated parameter, if required. `decden` is the wavelet decomposition of the denoised signal, and `thresh` are the threshold values.```
````[xd,thresh] = mswden("densig",dec,meth,param)` returns a denoised version `xd ` of the multisignal and the threshold values `thresh`.```
````[decden,thresh] = mswden("dendec",dec,meth,param)` returns the wavelet decomposition `decden` of the denoised multisignal and the threshold values `thresh`.```
````thresh = mswden("thr",dec,meth,param)` returns only the threshold values `thresh`. Denoising is not performed.```
````[___] = mswden(option,dirdec,x,wname,lev,meth,param)` before performing a denoising or computing thresholds, decomposes the multisignal `x` at level `lev` using the wavelet `wname`, in the direction `dirdec`. The `mswden` function returns the output arguments specified by `option`.```
````[___] = mswden(___,sorh)` specifies the type of thresholding to perform.```
````[___] = mswden(___,sorh,keepapp)` specifies whether to keep the approximation coefficients.```
````[___] = mswden(___,sorh,keepapp,idxsig)` specifies the indices of the initial signals, or `"all"`.```

## Examples

collapse all

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

Denoise the signals using the universal method of thresholding (`sqtwolog`) and the `sln` threshold rescaling (with a single estimation of level noise, based on the first level coefficients).

`[xd,decden,thresh] = mswden("den",dec,"sqtwolog","sln");`

Plot an original signal, and the corresponding denoised signal.

```idxA = 3; plot(Espiga3(:,idxA),"r") hold on plot(xd(:,idxA),"b") hold off grid on legend("Original","Denoised")```

## Input Arguments

collapse all

Wavelet decomposition structure of a multisignal, specified as a structure. `dec` is expected to be the output of `mdwtdec`.

Denoising method, specified as one of the following:

 `"rigrsure"` Principle of Stein's Unbiased Risk `"heursure"` Heuristic variant of the `"rigrsure"` method `"sqtwolog"` Universal threshold `sqrt(2*log(signalLength))` `"minimaxi"` Minimax thresholding (see `thselect`) `"penal"`, `"penalhi"`, `"penalme"`, `"penallo"` Penalization methods `"man_thr"` Manual method

Optional parameter used for denoising.

For the denoising methods `"rigrsure"`, `"heursure"`, `"sqtwolog"`, and `"minimaxi"`, `param` defines the multiplicative threshold rescaling, and is one of the following:

 `"one"` No rescaling `"sln"` Rescaling using a single estimation of level noise based on first level coefficients `"mln"` Rescaling using a level dependent estimation of level noise

For penalization methods, `param` specifies a sparsity parameter. The parameter, a real-valued scalar, should be such that: `1``param``10`. For the `penal` method, no control is done.

 `"penal"` Penal `"penalhi"` Penal high, `2.5` ≤ `param` ≤ `10` `"penalme"` Penal medium, `1.5` ≤ `param` ≤ `2.5` `"penallo"` Penal low, `1` ≤ `param` ≤ `2`

For the manual method `"man_thr"`, `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.

Desired function output arguments. This option determines the output arguments of `mswden` and is specified as one of the following:

• `"den"` — Return `xd`, `decden`, and `thresh`

• `"densig"` — Return `xd` and `thresh`

• `"dendec"` — Return `decden` and `thresh`

• `"thr"` — Return `thresh`

Direction indicator of the wavelet decomposition, specified as:

• `"r"`: Take the 1-D wavelet decomposition of each row of `x`

• `"c"`: Take the 1-D wavelet decomposition of each column of `x`

Multisignal, specified as a real-valued matrix.

Data Types: `double`

Level of decomposition, specified as a positive integer. `mdwtdec` does not enforce a maximum level restriction. Use `wmaxlev` to ensure that the wavelet coefficients are free from boundary effects. If boundary effects are not a concern, a good rule is to set `lev` less than or equal to `fix(log2(length(N)))`, where N is the number of samples in the 1-D data.

Analyzing wavelet, specified as a character vector or string scalar. The wavelet must be orthogonal or biorthogonal. Orthogonal and biorthogonal wavelets are designated as type 1 and type 2 wavelets respectively in the wavelet manager, `wavemngr`.

• Valid built-in orthogonal wavelet families are: Best-localized Daubechies (`"bl"`), Beylkin (`"beyl"`), Coiflets (`"coif"`), Daubechies (`"db"`), Fejér-Korovkin (`"fk"`), Haar (`"haar"`), Han linear-phase moments (`"han"`), Morris minimum-bandwidth (`"mb"`), Symlets (`"sym"`), and Vaidyanathan (`"vaid"`).

• Valid built-in biorthogonal wavelet families are: Biorthogonal Spline (`"bior"`), and Reverse Biorthogonal Spline (`"rbio"`).

For a list of wavelets in each family, see `wfilters`. You can also use `waveinfo` with the wavelet family short name. For example, `waveinfo("db")`. Use `wavemngr("type",wn)` to determine if the wavelet wn is orthogonal (returns 1) or biorthogonal (returns 2). For example, `wavemngr("type","db6")` returns 1.

## Output Arguments

collapse all

Denoised multisignal, returned as a matrix. `xd` is a denoised version of the original multisignal `x`.

Wavelet decomposition of the denoised multisignal, returned as a structure. The structure format is identical to the output of `mdwtdec`.

Threshold values, returned as a matrix.

Data Types: `double`

Type of thresholding to perform, specified as one of these:

• `"s"` — Soft thresholding

• `"h"` — Hard thresholding

Keep the approximation coefficients flag, specified as a numeric or logical `1` (`true`) or `0` (`false`).

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

## References

[1] Birgé, L., and P. Massart. “From Model Selection to Adaptive Estimation.” Festschrift for Lucien Le Cam: Research Papers in Probability and Statistics (E. Torgersen, D. Pollard, and G. Yang, eds.). New York: Springer-Verlag, 1997, pp. 55–88.

[2] DeVore, R. A., B. Jawerth, and B. J. Lucier. “Image Compression Through Wavelet Transform Coding.” IEEE Transactions on Information Theory. Vol. 38, Number 2, 1992, pp. 719–746.

[3] Donoho, D. L. “Progress in Wavelet Analysis and WVD: A Ten Minute Tour.” Progress in Wavelet Analysis and Applications (Y. Meyer, and S. Roques, eds.). Gif-sur-Yvette: Editions Frontières, 1993.

[4] Donoho, D. L., and I. M. Johnstone. “Ideal Spatial Adaptation by Wavelet Shrinkage.” Biometrika. Vol. 81, pp. 425–455, 1994.

[5] Donoho, D. L., I. M. Johnstone, G. Kerkyacharian, and D. Picard. “Wavelet Shrinkage: Asymptopia?” Journal of the Royal Statistical Society, series B, Vol. 57, No. 2, pp. 301–369, 1995.

[6] Donoho, D. L., and I. M. Johnstone. “Ideal denoising in an orthonormal basis chosen from a library of bases.” C. R. Acad. Sci. Paris, Ser. I, Vol. 319, pp. 1317–1322, 1994.

[7] Donoho, D. L. “De-noising by Soft-Thresholding.” IEEE Transactions on Information Theory. Vol. 42, Number 3, pp. 613–627, 1995.

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