# tqwt

Tunable Q-factor wavelet transform

## Description

returns the
tunable Q-factor wavelet transform (TQWT) of `wt`

= tqwt(`x`

)`x`

.

The TQWT is computed to the maximum decomposition level with a quality factor of 1. For more information, see TQWT Decomposition Levels.

As implemented, the

`tqwt`

function uses a redundancy of 3. For more information, see Redundancy.

specifies one or more additional name-value arguments. For example, `wt`

= tqwt(`x`

,`Name=Value`

)```
wt =
tqwt(x,QualityFactor=2)
```

specifies a quality factor of 2.

## Examples

### Tunable Q-factor Wavelet Transform of Multisignal

Load a multichannel EEG signal. The signal has 23 channels.

```
load Espiga3
size(Espiga3,2)
```

ans = 23

Obtain the tunable Q-factor wavelet transform of the multisignal to the maximum level using the default quality factor of 1.

wt = tqwt(Espiga3); numel(wt)

ans = 12

For 1 ≤ *i* ≤ `numel(wt)`

-1, the *i*th element of `wt`

contains the wavelet transform coefficients for the *i*th subband. The last element of `wt`

contains the lowpass subband coefficients. Confirm the number of columns of any element of `wt`

is equal to the number of channels.

k = 7; size(wt{k},2)

ans = 23

Reconstruct the multisignal and demonstrate perfect reconstruction.

xrec = itqwt(wt,size(Espiga3,1)); max(abs(xrec(:)-Espiga3(:)))

ans = 5.1159e-13

### Inspect TQWT Information Structure

Load an ECG signal. Obtain the TQWT of the signal down to level 5 with a quality factor of 2. Also obtain information of the TQWT.

```
load wecg
lvl = 5;
qf = 2;
[wt,info] = tqwt(wecg,Level=lvl,QualityFactor=qf);
```

Plot the original signal and compare with the lowpass subband coefficients.

subplot(2,1,1) plot(wecg) title("Original Signal") axis tight subplot(2,1,2) plot(wt{end}) title("Lowpass Subband Coefficients") axis tight

Inspect the TQWT information structure. For each subband, confirm that the ratio of the center frequency to the approximate bandwidth equals the quality factor.

info

`info = `*struct with fields:*
CenterFrequencies: [0.3333 0.2593 0.2016 0.1568 0.1220]
Bandwidths: [0.1667 0.1296 0.1008 0.0784 0.0610]
Level: 5
Alpha: 0.7778
Beta: 0.6667

info.CenterFrequencies./info.Bandwidths

`ans = `*1×5*
2.0000 2.0000 2.0000 2.0000 2.0000

As implemented, the `tqwt`

function uses the redundancy $$r=3$$. Confirm the highpass and lowpass scaling factors, `info.Beta`

and `info.Alpha`

respectively, satisfy the relation $$r=\frac{\beta}{1-\alpha}$$.

info.Beta/(1-info.Alpha)

ans = 3

## Input Arguments

`x`

— Input signal

vector | matrix | 3-D array

Input signal, specified as a single- or double-precision vector, matrix, or 3-D
array. If `x`

is a matrix or 3-D array, the TQWT is computed along
the columns of `x`

. For 3-D arrays, `tqwt`

interprets the first dimension as time, the second dimension as channels, and the third
dimension as a batch.

The TQWT is defined for even-length signals. If the number of samples in
`x`

is odd, the last sample of `x`

is repeated
to obtain an even-length signal.

**Data Types: **`single`

| `double`

**Complex Number Support: **Yes

### Name-Value Arguments

Specify optional pairs of arguments as
`Name1=Value1,...,NameN=ValueN`

, where `Name`

is
the argument name and `Value`

is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.

**Example: **`wt = tqwt(x,Level=3,QualityFactor=2)`

`Level`

— Decomposition level

positive integer

Decomposition level of the TQWT, specified as a positive integer between 1 and the maximum level. The maximum level depends on the signal length and quality factor. For more information, see TQWT Decomposition Levels.

**Example: **`wt = tqwt(x,Level=3)`

specifies a decomposition level of
3.

**Data Types: **`single`

| `double`

`QualityFactor`

— Quality factor

`1`

(default) | positive scalar

Quality factor, specified as a real-valued scalar greater than or equal to 1. The quality factor is the ratio of the center frequency to the bandwidth of the filters. If unspecified, the quality factor defaults to 1.

**Example: **`wt = tqwt(x,QualityFactor=1.5)`

specifies a quality
factor of 1.5.

**Data Types: **`single`

| `double`

## Output Arguments

`wt`

— Tunable Q-factor wavelet transform

cell array

Tunable Q-factor wavelet transform, returned as a cell array.
`wt`

is a cell array with length equal to the maximum level of the
TQWT plus one. The *i*th element of `wt`

contains
the TQWT coefficients for the *i*th subband. The subbands are ordered
by decreasing center frequency. The final element of `wt`

contains
the lowpass subband coefficients. The wavelet coefficients in `wt`

match `x`

in data type and complexity.

If

`x`

is a row vector, each element of`wt`

is a column vector containing the TQWT coefficients.If

`x`

is a matrix or 3-D array, the column and page sizes of each element of`wt`

match the column and page sizes of`x`

.

**Data Types: **`single`

| `double`

`info`

— Transform information

structure array

Transform information, returned as a structure array. `info`

has
five fields:

`CenterFrequencies`

— The normalized center frequencies (cycles/sample) of the wavelet subbands in the TQWT of`x`

. To convert the frequencies to hertz, multiply`CenterFrequencies`

by the sample rate.`Bandwidths`

— The approximate bandwidths of the wavelet subbands in normalized frequency (cycles/sample). To convert the bandwidths to hertz, multiply`Bandwidths`

by the sample rate.`Level`

— Level of the TQWT. Note that`info.Level`

may be different from your specified level if you specify a level greater than the maximum supported level for your signal length and quality factor.`Beta`

— Highpass scaling factor. The highpass scaling factor is computed from the quality factor as`2/(`

. Accordingly,`QualityFactor`

+1)`0 < Beta ≤ 1`

.`Alpha`

— Lowpass scaling factor. The lowpass scaling factor is computed from the highpass scaling factor as`1-Beta/3`

. Accordingly,`2/3 ≤ Alpha < 1`

.

**Data Types: **`struct`

## More About

### TQWT Decomposition Levels

The TQWT minimum and maximum decomposition levels depend on the signal
length, *N*, and quality factor, *Q*. In the description
that follows, the signal length, *N*, is one sample larger than the input
length for odd-length signals.

The maximum decomposition level is

$$\lfloor \mathrm{log}\left(\frac{N}{4Q+4}\right)/\mathrm{log}\left(\frac{3Q+3}{3Q+1}\right)\rfloor ,$$

where the ⌊ ⌋ symbols denote the floor function.

The minimum level also depends on the signal length and quality factor. The logarithm of
*N*, $$\mathrm{log}(N),$$ must satisfy the following inequality:

$$\mathrm{log}(N)\ge \mathrm{log}(4Q+4)-\mathrm{log}(3Q+1)+\mathrm{log}(3Q+3).$$

If $$\mathrm{log}(N)<\mathrm{log}(4Q+4)-\mathrm{log}(3Q+1)+\mathrm{log}(3Q+3),$$ the maximum level is less than 1 and `tqwt`

throws an
error.

### Redundancy

The TQWT algorithm depends on scaling in the frequency domain:

lowpass scaling — frequency-domain scaling by

*α*that preserves low-frequency contenthighpass scaling — frequency-domain scaling by

*β*that preserves high-frequency content

The redundancy is defined to be

$$r=\frac{\beta}{1-\alpha}.$$

For more information, see Tunable Q-factor Wavelet Transform.

## References

[1] Selesnick, Ivan W. “Wavelet
Transform With Tunable Q-Factor.” *IEEE Transactions on Signal
Processing* 59, no. 8 (August 2011): 3560–75. https://doi.org/10.1109/TSP.2011.2143711.

## Extended Capabilities

### C/C++ Code Generation

Generate C and C++ code using MATLAB® Coder™.

### GPU Arrays

Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.

Usage notes and limitations:

The signal

`x`

is the only supported input argument.The TQWT array

`wt`

is the only supported output argument.

## Version History

**Introduced in R2021b**

## See Also

### Apps

### Functions

## MATLAB 명령

다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.

명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.

# Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)