# wnoisest

Estimate noise of 1-D wavelet coefficients

## Syntax

``stdc = wnoisest(c,l,s)``
``stdc = wnoisest(c)``

## Description

````stdc = wnoisest(c,l,s)` returns estimates of the detail coefficients' standard deviation for levels specified in `s`. [`c`,`l`] is a multilevel wavelet decomposition structure and is the output of `wavedec`.The estimator used is Median Absolute Deviation / 0.6745, well suited for zero-mean Gaussian white noise in the denoising one-dimensional model (see `thselect` for more information).```

example

````stdc = wnoisest(c)` returns estimates of the standard deviations of `c`, where `c` is a one-dimensional cell array or a numeric array.```

## Examples

collapse all

Estimate of the noise standard deviation in an N(0,1) white Gaussian noise vector with outliers.

Create an N(0,1) noise vector with 10 randomly-placed outliers.

```rng default; x = randn(1000,1); P = randperm(length(x)); indices = P(1:10); x(indices(1:5)) = 10; x(indices(6:end)) = -10;```

Obtain the discrete wavelet transform down to level 2 using the Daubechies’ extremal phase wavelet with 3 vanishing moments.

```[c,l] = wavedec(x,2,'db3'); stdc = wnoisest(c,l,1:2)```
```stdc = 1×2 0.9650 1.0279 ```

In spite of the outliers, `wnoisest` provides a robust estimate of the standard deviation.

## Input Arguments

collapse all

Input, specified as a vector, matrix, or 1-D cell array.

• When used in the syntax ```stdc = wnoisest(c,l,s)```, `c` is the wavelet decomposition output of `wavedec`: ```[c,l] = wavedec(x,N,wname)```. The bookkeeping vector `l` contains the number of coefficients by level.

• When used in the syntax `stdc = wnoisest(c)`, `c` is either a numeric matrix or 1-D cell array.

Data Types: `double`

Bookkeeping vector, specified as a vector of positive integers. `l` is the output of `wavedec`: ```[c,l] = wavedec(x,N,wname)```. The bookkeeping vector is used to parse the coefficients in the wavelet decomposition `c` by level.

Data Types: `double`

Detail coefficient levels, specified as a vector of positive integers less than or equal to N, where N is the level of the wavelet decomposition used to obtain [`c`,`l`]. Specifically, ```N = length(l)-2```.

Data Types: `double`

## Output Arguments

collapse all

Standard deviation estimates, returned as a vector or cell array.

• If `c` is the output of `wavedec`, `stdc` are estimates of the detail coefficients' standard deviation for the levels specified in `s`.

• If `c` is a one-dimensional cell array, `stdc{k}` is an estimate of the standard deviation of `c{k}`, where ```k = 1,…,length(c)```.

• If `c` is a numeric array, `stdc(k)` is an estimate of the standard deviation of `c(k,:)`, where ```k = 1,…,size(c,1)```.

## References

[1] Donoho, David L, and Iain M Johnstone. “Ideal Spatial Adaptation by Wavelet Shrinkage.” Biometrika 81, no. 3 (September 1, 1994): 425–55. https://doi.org/10.1093/biomet/81.3.425.

[2] Donoho, David L., and Iain M. Johnstone. “Adapting to Unknown Smoothness via Wavelet Shrinkage.” Journal of the American Statistical Association 90, no. 432 (December 1995): 1200–1224. https://doi.org/10.1080/01621459.1995.10476626.

## Version History

Introduced before R2006a