This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.


Maximal overlap discrete wavelet transform


w = modwt(x)
w = modwt(x,wname)
w = modwt(x,Lo,Hi)
w = modwt(___,lev)
w = modwt(___,'reflection')



w = modwt(x) returns the maximal overlap discrete wavelet transform (MODWT) of the 1-D real-valued signal, x.


w = modwt(x,wname) uses the orthogonal wavelet, wname, for the MODWT.


w = modwt(x,Lo,Hi) uses the scaling filter, Lo, and wavelet filter, Hi, to compute the MODWT. These filters must satisfy the conditions for an orthogonal wavelet. You cannot specify Lo and Hi if you specify wname.


w = modwt(___,lev) computes the MODWT down to the specified level, lev, using any of the arguments from previous syntaxes.


w = modwt(___,'reflection') computes the MODWT using reflection boundary handling. Other inputs can be any of the arguments from previous syntaxes. Before computing the wavelet transform, modwt extends the signal symmetrically at the right boundary to twice the signal length, [x flip(x)]. The number of wavelet and scaling coefficients that modwt returns is equal to twice the length of the input signal. By default, the signal is extended periodically.


collapse all

Obtain the MODWT of an electrocardiogram (ECG) signal using the default sym4 wavelet down to the maximum level.

load wecg;
wtecg = modwt(wecg);

wtecg is 12-by-2048 matrix. The first eleven rows are the wavelet coefficients for scales to . The final row contains the scaling coefficients at scale . Plot the detail (wavelet) coefficients for scale .

title('Level 3 Wavelet Coefficients')

Obtain the MODWT of Southern Oscillation Index data with the 'db2' wavelet down to the maximum level.

load soi;
wsoi = modwt(soi,'db2');

Obtain the MODWT of the Deutsche Mark - U.S. Dollar exchange rate data using the Fejer-Korovkin length 8 scaling and wavelet filters.

load DM_USD;
[Lo,Hi] = wfilters('fk8');
wdm = modwt(DM_USD,Lo,Hi);

Obtain the MODWT of an ECG signal down to scale , which corresponds to level four. Use the default 'sym4' wavelet.

load wecg;
wtecg = modwt(wecg,4);

wtecg is a 5-by-2048 matrix. The row size is L+1, where, in this case, the level (L) is 4. The column size matched the number of input samples.

Obtain the MODWT of an ECG signal using reflection boundary handling. Use the default 'sym4' wavelet and obtain the transform down to level 4.

load wecg;
wtecg = modwt(wecg,4,'reflection');

wtecg has 4096 columns, which is twice the length of the input signal, wecg.

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 Arrythmia Database.

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

Take the MODWT of the signal.

wtecg = modwt(ecgsig,wv);

The input data are samples of a function evaluated at -many time points. The function can be expressed as a linear combination of the scaling function and wavelet at varying scales and translations: where and is the number of levels of wavelet decomposition. The first sum is the coarse scale approximation of the signal, and the are the details at successive scales. MODWT returns the -many coefficients and the -many detail coefficients of the expansion. Each row in wtecg contains the coefficients at a different scale.

When taking the MODWT of a signal of length , there are -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 , and the number of rows in wtecg is .

The MODWT partitions the energy across the various scales and scaling coefficients: where is the input data, are the detail coefficients at scale , and 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=1x1 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.0873e-09

Take the MODWTMRA of the signal.

mraecg = modwtmra(wtecg,wv);

MODWTMRA returns the projections of the function onto the various wavelet subspaces and final scaling space. That is, MODWTMRA returns and the -many evaluated at -many time points. Each row in mraecg is a projection of 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 evaluated at that time point and compare with the original signal.

time_point = 1000;
ans = 3.1009e-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

Input signal, specified as a row or column vector. x must have at least two elements.

By default, modwt computes the wavelet transform down to level floor(log2(length(x))) using the Daubechies least-asymmetric wavelet with four vanishing moments ('sym4') and periodic boundary handling.

Data Types: double

Analyzing wavelet, specified as a character vector that corresponds to an orthogonal wavelet. Valid orthogonal wavelet families begin with one of the following character vectors, followed by an integer, N, which indicates the number of vanishing moments, for example, symN. For 'fk', N is the number of coefficients.

  • 'haar' — Haar wavelet

  • 'db' — Daubechies wavelet

  • 'sym' — Symlets wavelet

  • 'coif' — Coiflets wavelet

  • 'fk' — Fejer-Korovkin wavelet

To check if your wavelet is orthogonal, use wavemngr('type',wname) and verify that it returns 1 as the wavelet type. To determine valid values for N, use waveinfo, for example, waveinfo('db').

Scaling filter, specified as an even-length real-valued vector. Lo must satisfy the conditions necessary to generate an orthogonal scaling function. You can specify Lo only if you do not specify wname.

Wavelet filter, specified as an even-length real-valued vector. Hi must satisfy the conditions necessary to generate an orthogonal wavelet. You can specify Hi only if you do not specify wname.

Transform level, specified as a positive integer less than or equal to floor(log2(length(x))).

Output Arguments

collapse all

Wavelet transform , returned as an L+1-by-N matrix containing wavelet coefficients and final-level scaling coefficients. L is the level of the MODWT. N is equal to the input signal length unless you specify 'reflection' boundary handling, in which case N is twice the length of the input signal. The kth row of w contains the wavelet coefficients for scale 2k (wavelet scale 2(k-1)). The final, (L+1)th, row of w contains the scaling coefficients for scale 2L.


The standard algorithm for the MODWT implements the circular convolution directly in the time domain. This implementation of the MODWT performs the circular convolution in the Fourier domain. The wavelet and scaling filter coefficients at level j are computed by taking the inverse discrete Fourier transform (DFT) of a product of DFTs. The DFTs in the product are the signal’s DFT and the DFT of the jth level wavelet or scaling filter.

Let Hk and Gk denote the length N DFTs of the MODWT wavelet and scaling filters, respectively. Let j denote the level and N denote the sample size.

The jth level wavelet filter is defined by




The jth level scaling filter is





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

[2] Percival, D. B., and H. O. Mofjeld. “Analysis of subtidal coastal sea level fluctuations using wavelets.”Journal of the American Statistical Association. Vol. 92, pp 868–880.

Extended Capabilities

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

Introduced in R2015b

Was this topic helpful?