Main Content

modwtmra

Multiresolution analysis based on MODWT

Description

mra = modwtmra(w) returns the multiresolution analysis (MRA) of the maximal overlap discrete wavelet transform (MODWT) matrix, w. The MODWT matrix, w, is the output of the modwt function. By default, modwtmra assumes that you obtained w using the 'sym4' wavelet with periodic boundary handling.

example

mra = modwtmra(w,wname) constructs the MRA using the wavelet corresponding to wname. The wname wavelet must be the same wavelet used to obtain the MODWT.

example

mra = modwtmra(w,Lo,Hi) constructs the MRA using the scaling filter Lo and wavelet filter Hi. The Lo and Hi filters must be the same filters used to obtain the MODWT.

example

mra = modwtmra(___,'reflection') uses the reflection boundary condition in the construction of the MRA using any of the arguments from previous syntaxes. If you specify 'reflection', modwtmra assumes that the column dimension of w is even and equals twice the length of the original signal.

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. By default, modwtmra uses periodic extension at the boundary.

example

Examples

collapse all

Obtain the MODWTMRA of a simple time-series signal and demonstrate perfect reconstruction.

Create a time-series signal

t = 1:10;
x = sin(2*pi*200*t);

Obtain the MODWT and the MODWTMRA and sum the MODWTMRA rows.

m = modwt(x);
mra = modwtmra(m);
xrec = sum(mra);

Use the maximum of the absolute values to show that the difference between the original signal and the reconstruction is extremely small. The largest absolute value is on the order of 10-25, which demonstrates perfect reconstruction.

max(abs(x-xrec))
ans = 
5.5738e-25

Construct an MRA of an ECG signal down to level four using the db2 wavelet. The data are taken from Percival & Walden (2000), p.125 (data originally provided by William Constantine and Per Reinhall, University of Washington). The sampling frequency for the ECG signal is 180 hertz.

load wecg;
lev = 4;
wtecg = modwt(wecg,'db2',lev);
mra = modwtmra(wtecg,'db2');

Plot the ECG waveform and the MRA.

t = (0:numel(wecg)-1)/180;
subplot(6,1,1)
plot(t,wecg)
for kk = 2:lev+2
    subplot(6,1,kk)
    plot(t,mra(kk-1,:))
end
xlabel('Time (s)')
set(gcf,'Position',[0 0 500 700])

Figure contains 6 axes objects. Axes object 1 contains an object of type line. Axes object 2 contains an object of type line. Axes object 3 contains an object of type line. Axes object 4 contains an object of type line. Axes object 5 contains an object of type line. Axes object 6 with xlabel Time (s) contains an object of type line.

Construct a multiresolution analysis for the Southern Oscillation Index data. The sampling period is one day. Plot the level eight details corresponding to a scale of 28 days. The details at this scale capture oscillations on a scale of approximately one year.

load soi
wtsoi = modwt(soi);
mrasoi = modwtmra(wtsoi);
plot(mrasoi(8,:))
title('Level 8 Details')

Figure contains an axes object. The axes object with title Level 8 Details contains an object of type line.

Obtain the MRA for the Deutsch Mark - U.S. Dollar exchange rate data using the minimum bandwidth scaling and wavelet filters with four coefficients.

load DM_USD;
Lo = [0.4801755, 0.8372545, 0.2269312, -0.1301477];
Hi = qmf(Lo);
wdm = modwt(DM_USD,Lo,Hi);
mra = modwtmra(wdm,Lo,Hi);

Load the ECG data.

load wecg

Obtain the MODWT of the signal using the filters associated with the 8-coefficient Fejér-Korovkin filters.

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

Obtain the MRA of the signal using the filters.

mra = modwtmra(wtecg,Lo,Hi);

Obtain a second MRA of the signal using the wavelet name. Confirm the multiresolution analyses are equal.

mra2 = modwtmra(wtecg,"fk8");
max(abs(mra(:)-mra2(:)))
ans = 
0

Obtain the MRA for an ECG signal using 'reflection' boundary handling. The data are taken from Percival & Walden (2000), p.125 (data originally provided by William Constantine and Per Reinhall, University of Washington).

load wecg;
wtecg = modwt(wecg,'reflection');
mra = modwtmra(wtecg,'reflection');

Show that the number of columns in the MRA is equal to the number of elements in the original signal.

isequal(size(mra,2),numel(wecg))
ans = logical
   1

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

load Espiga3

Obtain the MRA of the multisignal.

w = modwt(Espiga3);
mra = modwtmra(w);

Input Arguments

collapse all

MODWT transform of a signal or multisignal down to level LEV, specified as a matrix or 3-D array, respectively. w is an LEV+1-by-N matrix for the MODWT of an N-point signal, and an LEV+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 wavelet used to obtain the MODWT with the modwt function.

Orthogonal wavelet filters, specified as a pair of even-length real-valued vectors. Lo is the scaling (lowpass) filter, and Hi is the wavelet (highpass) 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 modwtmra function internally uses the second pair of filters returned by wfilters. For example,

mra = modwtmra(wt,"db2");

is equivalent to

[~,~,Lo,Hi] = wfilters("db2"); mra = modwtmra(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

Output Arguments

collapse all

Multiresolution analysis, returned as a matrix or 3-D array. mra is a LEV+1-by-N matrix or LEV+1-by-N-by-NC array where LEV is the level of the MODWT and N is the length of the analyzed signal. The kth row of mra contains the details for the kth level. The (LEV+1)th row of mra contains the LEVth level smooth.

By default, mra is the same size as the input w. If you specify reflection boundary handling, then mra has one half the size of the column dimension as the input w.

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] Whitcher, Brandon, Peter Guttorp, and Donald B. Percival. “Wavelet Analysis of Covariance with Application to Atmospheric Time Series.” Journal of Geophysical Research: Atmospheres 105, no. D11 (June 16, 2000): 14941–62. https://doi.org/10.1029/2000JD900110.

[3] 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