# ilwt

Inverse 1-D lifting wavelet transform

## Syntax

``xr = ilwt(ca,cd)``
``xr = ilwt(ca,cd,Name,Value)``

## Description

````xr = ilwt(ca,cd)` returns the 1-D inverse wavelet transform based on the approximation coefficients, `ca`, and cell array of detail coefficients, `cd`. By default, `ilwt` assumes you used the lifting scheme associated with the `db1` wavelet to obtain `ca` and `cd`. If you do not modify the coefficients, `xr` is a perfect reconstruction of the signal.```

example

````xr = ilwt(ca,cd,Name,Value)` specifies options using one or more name-value arguments. For example, ```xr = ilwt(ca,cd,'Wavelet','db2')``` specifies the orthogonal wavelet `db2`.For perfect reconstruction, all name-value arguments must match those used in `lwt` to obtain `ca` and `cd`.```

## Examples

collapse all

Create a lifting scheme associated with the `db3` wavelet. Specify an integer-valued signal whose length is a power of 2.

```lsc = liftingScheme('Wavelet','db3'); n = 8; sig = 1:2^n;```

Use the lifting scheme to obtain the integer-valued LWT of the signal down to the maximum decomposition level.

`[ca,cd] = lwt(sig,'LiftingScheme',lsc,'Int2Int',true);`

Confirm the detail coefficients `cd` are a cell array whose length is equal to the exponent of 2.

`length(cd)`
```ans = 8 ```

Obtain the inverse LWT up to level 0. Confirm perfect reconstruction.

```xrec0 = ilwt(ca,cd,'LiftingScheme',lsc,'Int2Int',true,'Level',0); max(abs(xrec0(:)-sig(:)))```
```ans = 0 ```

Obtain the inverse LWT up to level 1.

`xrec1 = ilwt(ca,cd,'LiftingScheme',lsc,'Int2Int',true,'Level',1);`

Obtain the level 1 decomposition of the signal. Confirm the approximation coefficients are equal to `xrec1`.

```[ca,cd] = lwt(sig,'LiftingScheme',lsc,'Int2Int',true,'Level',1); max(abs(ca(:)-xrec1(:)))```
```ans = 0 ```

Load the 23 channel EEG data `Espiga3`. The channels are arranged column-wise.

```load Espiga3 size(Espiga3)```
```ans = 1×2 995 23 ```

Obtain the LWT of the multichannel signal using the `db4` wavelet down to the default maximum decomposition level.

```wv = 'db4'; [ca,cd] = lwt(Espiga3,'Wavelet',wv);```

Reconstruct the multichannel signal.

`xrec = ilwt(ca,cd,'Wavelet',wv);`

Because the original signal has an odd number of samples in each channel, confirm the reconstruction has one more row than the original signal.

`size(xrec)`
```ans = 1×2 996 23 ```

Confirm the last row in the reconstruction is equal to the previous row.

`max(abs(xrec(end-1,:)-xrec(end,:)))`
```ans = 5.6843e-14 ```

Delete the last row from the reconstruction. Confirm the result is equal to the original signal.

```xrec(end,:) = []; max(abs(Espiga3(:)-xrec(:)))```
```ans = 4.5475e-13 ```

## Input Arguments

collapse all

Approximation (lowpass) coefficients at the coarsest level, specified as a scalar, vector, or matrix. The coefficients are the output of `lwt`.

If `ca` and the elements of `cd` are matrices, `xr` is a matrix where each column is the inverse wavelet transform of the corresponding columns in `ca` and `cd`.

Data Types: `single` | `double`
Complex Number Support: Yes

Detail coefficients, specified as an L-by-1 cell array, where L is the level of the transform. The elements of `cd` are in order of decreasing resolution. The coefficients are the output of `lwt`.

If `ca` and the elements of `cd` are matrices, `xr` is a matrix where each column is the inverse wavelet transform of the corresponding columns in `ca` and `cd`.

Data Types: `single` | `double`
Complex Number Support: Yes

### Name-Value Pair Arguments

Specify optional comma-separated pairs of `Name,Value` arguments. `Name` is the argument name and `Value` is the corresponding value. `Name` must appear inside quotes. You can specify several name and value pair arguments in any order as `Name1,Value1,...,NameN,ValueN`.

Example: `xr = ilwt(ca,cd,'LiftingScheme',lsc,'Level',1)` uses the `lsc` lifting scheme to perform an inverse wavelet transform up to level 1.

Orthogonal or biorthogonal wavelet to use in the inverse LWT, specified as a character vector or string scalar. See the Wavelet property of `liftingScheme` for the list of supported wavelets. For perfect reconstruction, the specified wavelet must be the same wavelet that was used to obtain the coefficients `ca` and `cd`.

You cannot specify `'Wavelet'` and `'LiftingScheme'` name-value arguments at the same time.

Example: `xr = ilwt(ca,cd,'Wavelet','bior3.5')` uses the `bior3.5` biorthogonal wavelet.

Data Types: `char` | `string`

Lifting scheme to use in the inverse LWT, specified as a `liftingScheme` object. For perfect reconstruction, the specified lifting scheme must be the same lifting scheme that was used to obtain the coefficients `ca` and `cd`.

You cannot specify `'Wavelet'` and `'LiftingScheme'` name-value arguments at the same time.

Example: `xr = ilwt(ca,cd,'LiftingScheme',lScheme)` uses the `lScheme` lifting scheme.

Reconstruction level, specified as a nonnegative integer less than or equal to `length(cd)`-1. If unspecified, the reconstruction level defaults to 0 and `xr` is a perfect reconstruction of the signal.

Example: `xr = ilwt(ca,cd,'Level',1)` reconstructs the signal up to level 1.

Data Types: `double`

Extension mode to use in the LWT, specified as a `'periodic'` (default), `'zeropad'`, or `'symmetric'`. The value of `'Extension'` specifies how to extend the signal at the boundaries.

Example: `xr = ilwt(ca,cd,'Extension','symmetric')` specifies the symmetric extension mode.

Integer-valued data handling, specified as a numeric or logical `1` (`true`) or `0` (`false`).

• `1` (`true`) — Preserve integer-valued data

• `0` (`false`) — Do not preserve integer-valued data

Specify the `'Int2Int'` name-value argument only if all elements of the input are integers.

Example: `xr = ilwt(ca,cd,'Int2Int',true)` preserves integer-valued data.

## Output Arguments

collapse all

Inverse wavelet transform of `ca` and `cd`, returned as a vector or matrix. If `ca` is a scalar or vector, and the elements of `cd` are vectors, `xr` is a vector. If `ca` and the elements of `cd` are matrices, `xr` is a matrix where each column is the inverse wavelet transform of the corresponding columns in `ca` and `cd`.

Data Types: `single` | `double`

## Compatibility Considerations

expand all

Behavior changed in R2021a 