Main Content

mdwtrec

Multisignal 1-D wavelet reconstruction

Description

x = mdwtrec(dec) reconstructs the original matrix of signals from the wavelet decomposition structure dec (see mdwtdec).

example

x = mdwtrec(dec,idxsig) reconstructs the signals whose indices are specified in the vector idxsig.

y = mdwtrec(dec,type,lev) extracts or reconstructs the detail or approximation coefficients at level lev depending on the value of type.

a = mdwtrec(dec,"a") returns the reconstructed approximation coefficients. mdwtrec(dec,"a") is equivalent to mdwtrec(dec,"a",dec.level).

d = mdwtrec(dec,"d") returns a matrix containing the sum of all the details, so that x = a + d.

ca = mdwtrec(dec,"ca") returns a matrix containing the extracted approximation coefficients. mdwtrec(dec,"ca") is equivalent to mdwtrec(dec,"ca",dec.level).

cd = mdwtrec(dec,"cd",mode) returns a matrix containing all the detail coefficients concatenated in the order specified by mode.

cfs = mdwtrec(dec,"cfs",mode) returns a matrix containing all the coefficients in the order specified by mode.

y = mdwtrec(___,idxsig) extracts or reconstructs the coefficients whose indices are specified in the vector idxsig.

Examples

collapse all

This example shows how to reconstruct a multisignal and a user-specified signal within the multisignal.

Load the 23 channel EEG data Espiga3 [4]. The channels are arranged column-wise. The data is sampled at 200 Hz.

load Espiga3
size(Espiga3)
ans = 1×2

   995    23

Perform a decomposition at level 2 using the db2 wavelet.

dec = mdwtdec("c",Espiga3,2,"db2");

Reconstruct the original matrix of signals using the decomposition structure dec.

XR = mdwtrec(dec);

Compute the reconstruction error.

errREC = max(abs(Espiga3(:)-XR(:)))
errREC = 
3.5431e-10

Reconstruct the original signal at index 17, the corresponding approximation at level 2, and details at levels 1 and 2.

idx = 17;
Y = mdwtrec(dec,idx);
A2 = mdwtrec(dec,"a",2,idx);
D2 = mdwtrec(dec,"d",2,idx);
D1 = mdwtrec(dec,"d",1,idx);

Compute the reconstruction error for signal 17.

errREC = max(abs(Y-(A2+D2+D1)))
errREC = 
0

Input Arguments

collapse all

Wavelet decomposition of a multisignal, specified as a structure with the following fields:

  • dirDec — Direction indicator: 'r' (row) or 'c' (column)

  • level — Level of wavelet decomposition

  • wname — Wavelet name

  • dwtFilters — Structure with four fields: LoD, HiD, LoR, and HiR

  • dwtEXTM — DWT extension mode

  • dwtShift — DWT shift parameter (0 or 1)

  • dataSize — Size of x

  • ca — Approximation coefficients at level lev

  • cd — Cell array of detail coefficients, from level 1 to level lev

The format of dec matches the output of mdwtdec.

Indices of signals to reconstruct, specified as a positive integer-valued vector.

Example: If S is a matrix of 100 signals and dec = mdwtdec("r",S,3,"db2"), then mdwtrec(dec,[1 20 98]) reconstructs the signals whose row indices are 1, 20, and 98.

Level of coefficients to extract or reconstruct, specified as a nonnegative integer.

  • If type is "a" or "ca", then lev must be an integer in the interval [0, levdec], where levdec = dec.level.

  • If type is "d" or "cd", then lev must be an integer in the interval [1, levdec], where levdec = dec.level.

Output type, specified as one of the following:

  • "cd" — Detail coefficients of level lev are extracted

  • "d" — Detail coefficients of level lev are reconstructed

  • "ca" — Approximation coefficients of level lev are extracted

  • "a" — Approximation coefficients of level lev are reconstructed

Order of concatenation, specified as:

  • "descend" — The function concatenates the coefficients from level levdec to level 1, where levdec = dec.level.

  • "ascend" — The function concatenates the coefficients from level 1 to level levdec, where levdec = dec.level.

The concatenation is made row-wise if dec.dirDEC = 'r' or column-wise if dec.dirDEC = 'c'.

Output Arguments

collapse all

Reconstructed signals, returned as a matrix.

Data Types: single | double
Complex Number Support: Yes

Decomposition coefficients, returned as a matrix, depending on type:

  • "cd" — Extracted detail coefficients

  • "ca" — Extracted approximation coefficients

  • "d" — Reconstructed detail coefficients

  • "a" — Reconstructed approximation coefficients

Data Types: single | double
Complex Number Support: Yes

Reconstructed approximation coefficients, returned as a matrix.

Data Types: single | double
Complex Number Support: Yes

Reconstructed detail coefficients, returned as a matrix.

Data Types: single | double
Complex Number Support: Yes

Extracted approximation coefficients, returned as a matrix.

Data Types: single | double
Complex Number Support: Yes

Extracted detail coefficients, returned as a matrix.

Data Types: single | double
Complex Number Support: Yes

Extracted approximation and detail coefficients, returned as a matrix.

Data Types: single | double
Complex Number Support: Yes

References

[1] Daubechies, I. Ten Lectures on Wavelets. CBMS-NSF Regional Conference Series in Applied Mathematics. Philadelphia, PA: Society for Industrial and Applied Mathematics, 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. https://doi.org/10.1109/34.192463.

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

[4] Mesa, Hector. “Adapted Wavelets for Pattern Detection.” In Progress in Pattern Recognition, Image Analysis and Applications, edited by Alberto Sanfeliu and Manuel Lazo Cortés, 3773:933–44. Berlin, Heidelberg: Springer Berlin Heidelberg, 2005. https://doi.org/10.1007/11578079_96.

Extended Capabilities

Version History

Introduced in R2007a

expand all

See Also

|