Main Content


Multilevel 1-D discrete wavelet transform reconstruction


x = waverec(c,l,wname) reconstructs the 1-D signal x based on the multilevel wavelet decomposition structure [c,l] and the wavelet specified by wname. For more information, see wavedec.

Note: x = waverec(c,l,wname) is equivalent to x = appcoef(c,l,wname,0).

x = waverec(c,l,LoR,HiR) reconstructs the signal using the specified lowpass and highpass wavelet reconstruction filters LoR and HiR, respectively.


x = waverec(___,Mode=extmode) uses the specified discrete wavelet transform (DWT) extension mode extmode. This syntax can be used with either of the previous syntaxes.


collapse all

Load an ECG signal.

load wecg

Perform a level 3 wavelet decomposition of the signal using the db6 wavelet. Specify the asym extension mode.

[c,l] = wavedec(wecg,3,"db6",Mode="asym");

Reconstruct the signal using the wavelet decomposition structure. To ensure perfect reconstruction, specify the same extension mode used to obtain the decomposition.

x = waverec(c,l,"db6",Mode="asym");

Verify perfect reconstruction.

err = norm(wecg-x)
err = 2.5198e-11

Input Arguments

collapse all

Wavelet decomposition, specified as a vector. The vector contains the wavelet coefficients. For more information, see wavedec.

Data Types: single | double
Complex Number Support: Yes

Bookkeeping vector, specified as a vector of positive integers. The bookkeeping vector is used to parse the coefficients in the wavelet decomposition c by level. See wavedec.

Data Types: single | double

Wavelet, specified as a character vector or string scalar. wname must specify the same wavelet used with wavedec to obtain the decomposition [c,l].


waverec supports only Type 1 (orthogonal) or Type 2 (biorthogonal) wavelets. See wfilters for a list of orthogonal and biorthogonal wavelets.

Wavelet reconstruction filters, specified as a pair of even-length real-valued vectors. LoR is the lowpass reconstruction filter, and HiR is the highpass reconstruction filter. The lengths of LoR and HiR must be equal. For perfect reconstruction, LoR and HiR must be the reconstruction filters associated with the same wavelet used to obtain the wavelet decomposition c and l. For more information, see wfilters.

Data Types: single | double

Since R2023b

Extension mode to use for the inverse DWT, specified as:


DWT Extension Mode


Zero extension


Smooth extension of order 0

"spd" (or "sp1")

Smooth extension of order 1

"sym" or "symh"

Symmetric extension (half point): boundary value symmetric replication


Symmetric extension (whole point): boundary value symmetric replication

"asym" or "asymh"

Antisymmetric extension (half point): boundary value antisymmetric replication


Antisymmetric extension (whole point): boundary value antisymmetric replication

"ppd", "per"

Periodized extension

If the signal length is odd and mode is "per", an extra sample equal to the last value is added to the right and the extension is performed in "ppd" mode. If the signal length is even, "per" is equivalent to "ppd".

The global variable managed by dwtmode specifies the default extension mode. For perfect reconstruction, use the same extension mode that was used to obtain c and l from wavedec.

Output Arguments

collapse all

Reconstructed signal, returned as a vector.


[1] Daubechies, I. Ten Lectures on Wavelets, CBMS-NSF Regional Conference Series in Applied Mathematics. Philadelphia, PA: SIAM Ed, 1992.

[2] Mallat, S.G. “A Theory for Multiresolution Signal Decomposition: The Wavelet Representation.” IEEE Transactions on Pattern Analysis and Machine Intelligence 11, no. 7 (July 1989): 674–93.

[3] Meyer, Y. Wavelets and Operators. Translated by D. H. Salinger. Cambridge, UK: Cambridge University Press, 1995.

Extended Capabilities

Version History

Introduced before R2006a

expand all

See Also

| |