Main Content

imodwt

Inverse maximal overlap discrete wavelet transform

Description

xrec = imodwt(w) reconstructs the signal based on the maximal overlap discrete wavelet transform (MODWT) coefficients in w. By default, imodwt assumes that you obtained w using the 'sym4' wavelet with periodic boundary handling. If you do not modify the coefficients, xrec is a perfect reconstruction of the signal.

example

xrec = imodwt(w,wname) reconstructs the signal using the orthogonal wavelet wname. wname must be the same wavelet used to analyze the signal input to modwt.

example

xrec = imodwt(w,Lo,Hi) reconstructs the signal using the orthogonal scaling filter Lo and the wavelet filter Hi. The Lo and Hi filters must be the same filters used to analyze the signal input to modwt.

example

xrec = imodwt(___,lev) reconstructs the signal up to level lev. xrec is a projection onto the scaling space at level lev. The default level is 0, which results in perfect reconstruction if you do not modify the coefficients.

example

xrec = imodwt(___,'reflection') uses the reflection boundary condition in the reconstruction. If you specify 'reflection', imodwt assumes that the length of the original signal length is one half the number of columns in the input coefficient matrix. By default, imodwt assumes periodic signal extension at the boundary.

You must enter the entire character vector 'reflection'. If you added a wavelet named 'reflection' using the wavelet manager, you must rename that wavelet prior to using this option. 'reflection' may be placed in any position in the input argument list after x.

example

Examples

collapse all

Obtain the MODWT of an ECG signal and demonstrate perfect reconstruction.

Load the ECG signal data and obtain the MODWT.

load wecg;

Obtain the MODWT and the Inverse MODWT.

w = modwt(wecg);
xrec = imodwt(w);

Use the L-infinity norm to show that the difference between the original signal and the reconstruction is extremely small. The largest absolute difference between the original signal and the reconstruction is on the order of 10-12, which demonstrates perfect reconstruction.

norm(abs(xrec'-wecg),Inf)
ans = 
2.3255e-12

Obtain the MODWT of Deutsche Mark-U.S. Dollar exchange rate data and demonstrate perfect reconstruction.

Load the Deutsche Mark-U.S. Dollar exchange rate data.

load DM_USD;

Obtain the MODWT and the Inverse MODWT using the 'db2' wavelet.

wdm = modwt(DM_USD,'db2');
xrec = imodwt(wdm,'db2');

Use the L-infinity norm to show that the difference between the original signal and the reconstruction is extremely small. The largest absolute difference between the original signal and the reconstruction is on the order of 10-13, which demonstrates perfect reconstruction.

norm(abs(xrec'-DM_USD),Inf)
ans = 
1.6370e-13

Obtain the MODWT of an ECG signal using the Fejér-Korovkin filters.

Load the ECG data.

load wecg

Create the 8-coefficient Fejér-Korovkin filters. Use the filters to obtain the MODWT of the ECG data.

[~,~,Lo,Hi] = wfilters("fk8");
wtecg = modwt(wecg,Lo,Hi);

Obtain the inverse MODWT using the filters.

xrec = imodwt(wtecg,Lo,Hi);

Obtain a second inverse MODWT using the wavelet name. Confirm both inverse transforms are equal.

xrec2 = imodwt(wtecg,"fk8");
max(abs(xrec-xrec2))
ans = 
0

Plot the original data and one of the reconstructions.

subplot(2,1,1)
plot(wecg)
title("ECG Signal")
subplot(2,1,2)
plot(xrec)
title("Reconstruction")

Figure contains 2 axes objects. Axes object 1 with title ECG Signal contains an object of type line. Axes object 2 with title Reconstruction contains an object of type line.

Obtain the MODWT of an ECG signal down to the maximum level and obtain the projection of the ECG signal onto the scaling space at level 3.

Load the ECG data.

load wecg;

Obtain the MODWT.

wtecg = modwt(wecg);

Obtain the projection of the ECG signal onto V3, the scaling space at level three by using the imodwt function.

v3proj = imodwt(wtecg,3);

Plot the original signal and the projection.

subplot(2,1,1)
plot(wecg)
title('Original Signal')
subplot(2,1,2)
plot(v3proj)
title('Projection onto V3')

Figure contains 2 axes objects. Axes object 1 with title Original Signal contains an object of type line. Axes object 2 with title Projection onto V3 contains an object of type line.

Note that the spikes characteristic of the R waves in the ECG are missing in the V3 approximation. You can see the missing details by examining the wavelet coefficients at level three.

Plot the level-three wavelet coefficients.

figure
plot(wtecg(3,:))
title('Level-Three Wavelet Coefficients')

Figure contains an axes object. The axes object with title Level-Three Wavelet Coefficients contains an object of type line.

Obtain the inverse MODWT using reflection boundary handling for Southern Oscillation Index data. The sampling period is one day. imodwt with the 'reflection' option assumes that the input matrix, which is the modwt output, is twice the length of the original signal length. imodwt reflection boundary handling reduces the number of wavelet and scaling coefficients at each scale by half.

load soi;
wsoi = modwt(soi,4,'reflection');
xrecsoi = imodwt(wsoi,'reflection');

Use the L-infinity norm to show that the difference between the original signal and the reconstruction is extremely small. The largest absolute difference between the original signal and the reconstruction is on the order of 10-11, which demonstrates perfect reconstruction.

norm(abs(xrecsoi'-soi),Inf)
ans = 
1.6421e-11

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

load Espiga3

Obtain the maximal overlap discrete wavelet transform down to the maximum level.

w = modwt(Espiga3);

Reconstruct the multichannel signal. Plot the original data and reconstruction.

xrec = imodwt(w);
subplot(2,1,1)
plot(Espiga3)
title('Original Data')
subplot(2,1,2)
plot(xrec)
title('Reconstruction')

Figure contains 2 axes objects. Axes object 1 with title Original Data contains 23 objects of type line. Axes object 2 with title Reconstruction contains 23 objects of type line.

Input Arguments

collapse all

MODWT transform of a signal or multisignal down to level L, specified as a matrix or 3-D array, respectively. w is an L+1-by-N matrix for the MODWT of an N-point signal, and an L+1-by-N-by-NC array for the MODWT of an N-by-NC multisignal. By default, imodwt assumes that you obtained the MODWT using the 'sym4' wavelet with periodic boundary handling.

Data Types: single | double
Complex Number Support: Yes

Orthogonal wavelet, specified as a character vector or string scalar. wname must be the same orthogonal wavelet used in the analysis with modwt. Orthogonal wavelets are designated as type 1 wavelets in the wavelet manager, wavemngr.

Valid built-in orthogonal wavelet families are: Best-localized Daubechies ("bl"), Beylkin ("beyl"), Coiflets ("coif"), Daubechies ("db"), Fejér-Korovkin ("fk"), Haar ("haar"), Han linear-phase moments ("han"), Morris minimum-bandwidth ("mb"), Symlets ("sym"), and Vaidyanathan ("vaid").

For a list of wavelets in each family, see wfilters. You can also use waveinfo with the wavelet family short name. For example, waveinfo("db"). Use wavemngr("type",wn) to determine if the wavelet wn is orthogonal (returns 1). For example, wavemngr("type","db6") returns 1.

Orthogonal wavelet filters, specified as a pair of even-length real-valued vectors. Lo is the scaling filter, and Hi is the wavelet filter. Lo and Hi must be the same filters used in the analysis with modwt. The filters must have equal length and satisfy the conditions for an orthogonal wavelet. For more information, see wfilters and isorthwfb. You cannot specify both wname and a filter pair Lo,Hi.

Note

By default, the wfilters function returns two pairs of filters associated with an orthogonal or biorthogonal wavelet you specify. To agree with the usual convention in the implementation of MODWT in numerical packages, when you specify an orthogonal wavelet wname, the imodwt function internally uses the second pair of filters returned by wfilters. For example,

xrec = imodwt(wt,"db2");

is equivalent to

[~,~,Lo,Hi] = wfilters("db2"); xrec = imodwt(wt,Lo,Hi);

This convention is different from the one followed by most Wavelet Toolbox™ discrete wavelet transform functions when decomposing a signal. Most functions internally use the first pair of filters.

Data Types: single | double

Reconstruction level, specified as a nonnegative integer between 0 and size(w,1)-2. The level must be less than the level used to obtain w from modwt. If lev is 0 and you do not modify the coefficients, imodwt produces a perfect reconstruction of the signal.

Output Arguments

collapse all

Reconstructed version of the original signal or multisignal based on the MODWT and the level of reconstruction, returned as a vector or matrix.

References

[1] Percival, Donald B., and Andrew T. Walden. Wavelet Methods for Time Series Analysis. Cambridge Series in Statistical and Probabilistic Mathematics. Cambridge ; New York: Cambridge University Press, 2000.

[2] 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 R2015b