Main Content

# icwtlin

Inverse continuous wavelet transform (CWT) for linearly spaced scales

This function is no longer recommended. Use `icwt` instead.

## Syntax

```xrec = icwtlin(cwtstruct) xrec = icwtlin(wav,meanSIG,cfs,scales,dt) xrec = icwtin(...,'plot') xrec = icwtlin (...,'signal',SIG,'plot') xrec = icwtlin(...,Name,Value) ```

## Description

`xrec = icwtlin(cwtstruct)` returns the inverse continuous wavelet transform (CWT) of the CWT coefficients obtained at linearly spaced scales.

Note

To use `icwtlin` you must:

• Use linearly-spaced scales in the CWT. `icwtlin` does not verify that the scales are linearly-spaced.

• Use one of the supported wavelets. See Input Arguments for a list of supported wavelets.

`xrec = icwtlin(wav,meanSIG,cfs,scales,dt)` returns the inverse CWT of the coefficients in `cfs`. The inverse CWT is obtained using the wavelet `wav`, the linearly spaced scales `scales`, the sampling period `dt`, and the mean signal value `meanSig`.

`xrec = icwtin(...,'plot')` plots the reconstructed signal `xrec` along with the CWT coefficients and CWT moduli. If the analyzing wavelet is complex-valued, the plot includes the real and imaginary parts of the CWT coefficients.

`xrec = icwtlin (...,'signal',SIG,'plot')` places a check box in the bottom-left corner of the plot. Enabling the check box superimposes the plot of the input signal `SIG` on the plot of the reconstructed signal. `SIG` can be a structure array, a cell array, or a vector. If `SIG` is a structure array, there must be two fields: `val` and `period`. The `val` field contains the signal and the `period` field contains the sampling period. If `SIG` is a cell array, `SIG{1}` contains the signal and `SIG{2}` is the sampling period.

`xrec = icwtlin(...,Name,Value)` returns the inverse CWT transform with additional options specified by one or more `Name,Value` pair arguments.

## Input Arguments

 `cwtstruct` A structure array that is the output of `cwtft` or constructed from the output of `cwt`. If you obtain `cwtstruct` from `cwtft`, the structure array contains seven fields: `cfs` — CWT coefficient matrix`scales` — Vector of linearly spaced scales. The scale vector must be linearly-spaced to ensure accurate reconstruction. `icwtlin` does not check that the spacing of your scale vector is linear.`frequencies` — frequencies in cycles per unit time (or space) corresponding to the scales. If the sampling period units are seconds, the frequencies are in hertz. The elements of frequencies are in decreasing order to correspond to the elements in the scales vector. `omega` — Angular frequencies used in the Fourier transform in radians/sample`MeanSIG` — Signal mean`dt` — Sampling period in seconds`wav` — Analyzing wavelet. `icwtlin` uses this wavelet as the reconstruction wavelet. The supported wavelets are: `'dog'` — An m-th order derivative of Gaussian wavelet where m is a positive even integer. m = 2 is the Mexican-hat or Ricker wavelet.`'morl'` — Analytic Morlet wavelet`'morlex' ` — Nonanalytic Morlet wavelet`'morl0' ` — Nonanalytic Morlet wavelet with exact zero mean`'mexh'` — Mexican-hat wavelet. This argument represents a special case of the derivative of Gaussian wavelet with m = 2. This wavelet is also known as the Ricker wavelet.`'paul'` — Paul wavelet`'bump'` — Bump wavelet If you create `cwtstruct` from the output of `cwt`, `cwtstruct` contains all of the preceding fields except `omega`. Using `cwt` to obtain the CWT coefficients, the valid analyzing wavelets are: Coiflets — `'coif1'`,`'coif2'` ,`'coif3'` ,`'coif4'`, `'coif5'`Biorthogonal wavelets — `'bior2.2'`, `'bior2.4'`, `'bior2.6'`, `'bior2.8'`, `'bior4.4'`, `'bior5.5'`, `bior6.8`Reverse biorthogonal wavelets — `'rbio2.2'`, `'rbio2.4'`, `'rbio2.6'`, `'rbio2.8'`, `'rbio4.4'`, `'rbio5.5'`, `'rbio6.8'`Complex Gaussian wavelets — `'cgau2'`, `'cgau4'`, `'cgau6'`, `'cgau8'`

### Name-Value Pair Arguments

 `'IdxSc'` Vector of scales to use in the signal reconstruction. Specifying a subset of scales results in a scale-localized approximation of the analyzed signal.

## Output Arguments

 `xrec` Reconstructed signal. Signal approximation based on the input CWT coefficient matrix, analyzing wavelet, selected scales, and sampling period. The purpose of the CWT inversion algorithm is not to produce a perfect reconstruction of the input signal. The inversion preserves time and scale-localized features in the reconstructed signal. The amplitude scaling in the reconstructed signal, however, can be significantly different. This difference in scaling can occur whether or not you use all the CWT coefficients in the inversion.

## Examples

Compute the inverse CWT of a sum of sine waves with disjoint support.

```% Define the signal N = 100; t = linspace(0,1,N); Y = sin(8*pi*t).*(t<=0.5) + sin(16*pi*t).*(t>0.5) ; % Define parameters before analysis dt = 0.001; maxsca = 1; s0 = 2*dt; ds = 2*dt; scales = s0:ds:maxsca; wname = 'morl'; SIG = {Y,dt}; WAV = {wname,[]}; % Compute the CWT using cwtft with linear scales cwtS = cwtft(SIG,'scales',scales,'wavelet',WAV); % Compute inverse CWT using linear scales Yrec = icwtlin(cwtS,'Signal',Y,'plot');``` Reconstruct an approximation to a noisy Doppler signal based on thresholded coefficients. Use the universal threshold. Assume the sampling period is 0.05 seconds.

```load noisdopp; Y = noisdopp; N = length(Y); % Define parameters before analysis % Assume sampling period is 0.05 dt = 0.05; maxsca = 100; s0 = 2*dt; ds = 4*dt; scales = s0:ds:maxsca; wname = 'morl'; SIG = {Y,dt}; WAV = {wname,[]}; % Compute CWT cwtS = cwtft(SIG,'scales',scales,'wavelet',WAV); % Select subset of coefficients cwtS1 = cwtS; Hfreq = cwtS.cfs(1:10,:); % Set threshold thr = sqrt(2*log(N))*median(abs(Hfreq(:)))/0.6745; newCFS = cwtS.cfs; % Set coefficients smaller than threshold in absolute value to 0 newCFS(abs(newCFS)<thr) = 0; cwtS1.cfs = newCFS; % Reconstruction from the modified structure YRDen = icwtlin(cwtS1,'signal',Y,'plot');```

Enable the Reconstructed Signal On/Off check box in the bottom-left corner. ## Algorithms

See  for a description of the inverse CWT algorithm for linearly spaced scales. The `icwtlin` function uses heuristic scaling factors for the analyzing wavelets. These scaling factors can result in significant differences in the amplitude scaling of the reconstructed signal.

## Alternatives

• `icwtft` — Computes the inverse for the CWT obtained using `cwtft` with logarithmically spaced scales. If you use linearly spaced scales in `cwtft`, or you obtain the CWT with `cwt`, use `icwtlin` to compute the inverse.

## References

 Daubechies, I. Ten Lectures on Wavelets, Philadelphia, PA: Society for Industrial and Applied Mathematics (SIAM), 1992.

 Farge, M. “Wavelet Transforms and Their Application to Turbulence”, Ann. Rev. Fluid. Mech., 1992, 24, 395–457.

 Mallat, S. A Wavelet Tour of Signal Processing, San Diego, CA: Academic Press, 1998.

 Sun,W. “Convergence of Morlet's Reconstruction Formula”, preprint, 2010.

 Torrence, C. and G.P. Compo. “A Practical Guide to Wavelet Analysis”, Bull. Am. Meteorol. Soc., 79, 61–78, 1998.

## See Also

Introduced in R2011b

## Support Get trial now