Multiresolution analysis based on MODWT



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.


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.


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.


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 length of the original signal is one half the number of columns in the input coefficient matrix.


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.

ans = 5.5738e-25

Construct an MRA of an ECG signal down to level four using the 'db2' wavelet.

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

Plot the ECG waveform and the MRA.

    for kk = 2:lev+2

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);
title('Level 8 Details')

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);

Obtain the MRA for an ECG signal using 'reflection' boundary handling.

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.

ans = logical

This example demonstrates the differences between the functions MODWT and MODWTMRA. The MODWT partitions a signal's energy across detail coefficients and scaling coefficients. The MODWTMRA projects a signal onto wavelet subspaces and a scaling subspace.

Choose the 'sym6' wavelet. Load and plot an ECG waveform. The ECG data is taken from the MIT-BIH Arrhythmia Database.

load mit200
wv = 'sym6';
grid on
title(['Signal Length = ',num2str(length(ecgsig))])

Take the MODWT of the signal.

wtecg = modwt(ecgsig,wv);

The input data are samples of a function f(x) evaluated at N-many time points. The function can be expressed as a linear combination of the scaling function ϕ(x) and wavelet ψ(x)at varying scales and translations: f(x)=k=0N-1ck2-J0/2ϕ(2-J0x-k)+j=1J0fj(x) where fj(x)=k=0N-1dj,k2-j/2ψ(2-jx-k) and J0 is the number of levels of wavelet decomposition. The first sum is the coarse scale approximation of the signal, and the fj(x) are the details at successive scales. MODWT returns the N-many coefficients {ck}and the (J0×N)-many detail coefficients {dj,k} of the expansion. Each row in wtecg contains the coefficients at a different scale.

When taking the MODWT of a signal of length N, there are floor(log2(N))-many levels of decomposition (by default). Detail coefficients are produced at each level. Scaling coefficients are returned only for the final level. In this example, since N=10000, J0=floor(log2(10000))=13 and the number of rows in wtecg is J0+1=13+1=14.

The MODWT partitions the energy across the various scales and scaling coefficients: ||X||2=j=1J0||Wj||2+||VJ0||2 where X is the input data, Wj are the detail coefficients at scale j, and VJ0 are the final-level scaling coefficients.

Compute the energy at each scale, and evaluate their sum.

energy_by_scales = sum(wtecg.^2,2);
Levels = {'D1';'D2';'D3';'D4';'D5';'D6';'D7';'D8';'D9';'D10';'D11';'D12';'D13';'A13'};
energy_table = table(Levels,energy_by_scales);
    Levels     energy_by_scales
    _______    ________________

    {'D1' }        0.31592     
    {'D2' }         2.6504     
    {'D3' }         28.802     
    {'D4' }         159.37     
    {'D5' }          300.5     
    {'D6' }         431.33     
    {'D7' }         444.93     
    {'D8' }         182.37     
    {'D9' }         45.381     
    {'D10'}         11.578     
    {'D11'}         19.809     
    {'D12'}         4.5406     
    {'D13'}          3.308     
    {'A13'}         192.46     
energy_total = varfun(@sum,energy_table(:,2))
energy_total=1×1 table


Confirm the MODWT is energy-preserving by computing the energy of the signal and comparing it with the sum of the energies over all scales.

energy_ecg = sum(ecgsig.^2);
ans = 4.0875e-09

Take the MODWTMRA of the signal.

mraecg = modwtmra(wtecg,wv);

MODWTMRA returns the projections of the function f(x) onto the various wavelet subspaces and final scaling space. That is, MODWTMRA returns k=0N-1ck2-J0/2ϕ(2-J0x-k)and the J0-many {fj(x)}evaluated at N-many time points. Each row in mraecg is a projection of f(x) onto a different subspace. This means the original signal can be recovered by adding all the projections. This is not true in the case of the MODWT. Adding the coefficients in wtecg will not recover the original signal.

Choose a time point, add the projections of f(x) evaluated at that time point and compare with the original signal.

time_point = 1000;
ans = 3.0942e-13

Confirm that, unlike MODWT, MODWTMRA is not an energy-preserving transform.

energy_ecg = sum(ecgsig.^2);
energy_mra_scales = sum(mraecg.^2,2);
energy_mra = sum(energy_mra_scales);
ans = 534.7949

The MODWTMRA is a zero-phase filtering of the signal. Features will be time-aligned. Demonstrate this by plotting the original signal and one of its projections. To better illustrate the alignment, zoom in.

hold on
grid on
xlim([4000 5000])

Make a similar plot using the MODWT coefficients at the same scale. Note that features will not be time-aligned. The MODWT is not a zero-phase filtering of the input.

hold on
grid on
xlim([4000 5000])


Goldberger A. L., L. A. N. Amaral, L. Glass, J. M. Hausdorff, P. Ch. Ivanov, R. G. Mark, J. E. Mietus, G. B. Moody, C-K Peng, H. E. Stanley. "PhysioBank, PhysioToolkit, and PhysioNet: Components of a New Research Resource for Complex Physiologic Signals." Circulation 101. Vol.23, e215-e220, 2000.

Moody, G. B. "Evaluating ECG Analyzers".

Moody G. B., R. G. Mark. "The impact of the MIT-BIH Arrhythmia Database." IEEE Eng in Med and Biol. Vol. 20, Number 3, 2001), pp. 45-50 .

Input Arguments

collapse all

Maximal overlap discrete wavelet transform, specified as a matrix. w is the output of modwt.

The input w is an L+1-by-N matrix containing the MODWT of an N-point input signal down to level L. By default, modwtmra assumes that you obtained the MODWT using the symlet wavelet with four vanishing moments, 'sym4', and using periodic boundary handling.

Data Types: double

Synthesis wavelet, specified as a character vector or string scalar. The synthesis wavelet must be the same wavelet used to obtain the MODWT with the modwt function.

Scaling filter, specified as an even-length real-valued vector. You can specify Lo only if you do not specify wname. Lo must be the same scaling filter used to obtain the MODWT with the modwt function.

Wavelet filter, specified as an even-length real-valued vector. You can specify Hi only if you do not specify wname. Hi must be the same wavelet filter used to obtain the MODWT with the modwt function.

Output Arguments

collapse all

Multiresolution analysis, returned as a matrix. By default, the mra is the same size as the input transform matrix w. If you specify reflection boundary handling, then mra has one half the number of columns as the input matrix w.

The output mra is an L+1-by-N matrix. The kth row of mra contains the details for the kth level. The (L+1)th row of mra contains the Lth level smooth.


[1] Percival, D. B., and Walden, A. T. Wavelet Methods for Time Series Analysis. Cambridge, U.K: Cambridge University Press, 2000.

[2] Whitcher, B., P. Guttorp, and D. B. Percival. "Wavelet analysis of covariance with application to atmospheric time series." Journal of Geophysical Research, Vol. 105, 2000, pp. 14941–14962.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

See Also


Introduced in R2015b