[2] Walden, A.T., and A. Contreras Cristan. âThe phase-corrected undecimated discrete wavelet packet transform and its application to interpreting the timing of ...
modwpt Maximal overlap discrete wavelet packet transform
Syntax wpt wpt wpt wpt
= = = =
modwpt(x) modwpt(x,wname) modwpt(x,lo,hi) modwpt( ___ ,lev)
[wpt,packetlevs] = modwpt( ___ ) [wpt,packetlevs,cfreq] = modwpt( ___ ) [wpt,packetlevs,cfreq,energy] = modwpt( ___ ) [wpt,packetlevs,cfreq,energy,relenergy] = modwpt( ___ ) [ ___ ] = modwpt( ___ ,Name,Value)
Description wpt = modwpt(x) returns the terminal nodes for the maximal overlap discrete wavelet packet transform (MODWPT) for the 1-D real-valued signal, x.
example
Note The output of the MODWPT is time-delayed compared to the input signal. Most filters used to obtain the MODWPT have a nonlinear phase response, which makes compensating for the time delay difficult. This is true for all orthogonal scaling and wavelet filters, except the Haar wavelet. It is possible to time-align the coefficients with the signal features, but the result is an approximation, not an exact alignment with the original signal. The MODWPT partitions the energy among the wavelet packets at each level. The sum of the energy over all the packets equals the total energy of the input signal. The output of MODWPT is useful for applications where you want to analyze the energy levels in different packets. The MODWPT details (modwptdetails) are the result of zero-phase filtering of the signal. The features in the MODWPT details align exactly with features in the input signal. For a given level, summing the details for each sample returns the exact original signal. The output of the MODWPT details is useful for applications that require time-alignment, such as nonparametric regression analysis.
wpt = modwpt(x,wname) returns the MODWPT using the orthogonal wavelet filter specified by the wname.
example
wpt = modwpt(x,lo,hi) returns the MODWPT using the orthogonal scaling filter, lo, and wavelet filter, hi.
example
wpt = modwpt( ___ ,lev) returns the terminal nodes of the wavelet packet tree at positive integer level lev. [wpt,packetlevs] = modwpt( ___ ) returns a vector of transform levels corresponding to the rows of wpt.
example
[wpt,packetlevs,cfreq] = modwpt( ___ ) returns the center frequencies of the approximate passbands corresponding to the rows of wpt. [wpt,packetlevs,cfreq,energy] = modwpt( ___ ) returns the energy (squared L2 norm) of the wavelet packet coefficients for the nodes in wpt.
example
[wpt,packetlevs,cfreq,energy,relenergy] = modwpt( ___ ) returns the relative energy for the wavelet packets in wpt.
example
[ ___ ] = modwpt( ___ ,Name,Value) returns the MODWPT with additional options specified by one or more Name,Value pair arguments.
example
Examples
collapse all
MODWPT Using Default Wavelet
Obtain the MODWPT of an electrocardiogram (ECG) signal using the default length 18 Fejer-Korovkin ('fk18') wavelet.
Try it in MATLAB
load wecg; wpt = modwpt(wecg); wpt is a 16-by-2048 matrix containing the sequency-ordered wavelet packet coefficients for the wavelet packet transform nodes. In this case, the nodes are at level 4. Each node corresponds to an approximate passband filtering of , where n = 0,...,15, and is the sampling frequency. Plot the wavelet packet coefficients at node (4,2), which is level 4, node 2. plot(wpt(3,:)) title('Node 4 Wavelet Packet Coefficients')
MODWPT Using Daubechies Extremal Phase Wavelet with Two Vanishing Moments
Obtain the MODWPT of Southern Oscillation Index data with the Daubechies extremal phase wavelet with two vanishing moments ('db2').
Try it in MATLAB
load soi; wsoi = modwpt(soi,'db2'); Verify that the size of the resulting transform contains 16 nodes. Each node is in a separate row. size(wsoi) ans = 16
12998
MODWPT Using Scaling and Wavelet Filters
Obtain the MODWPT of an ECG waveform using the Fejer-Korovkin length 18 scaling and wavelet filters.
Try it in MATLAB
load wecg; [lo,hi] = wfilters('fk18'); wpt = modwpt(wecg,lo,hi);
MODWPT Full Packet Tree and Passband Center Frequencies
Obtain the MODWPT and full wavelet packet tree of an ECG waveform using the default length 18 Fejer-Korovkin ('fk18') wavelet. Extract and plot the node coefficients at level 3, node 2. load wecg; [wpt,packetlevels,cfreq] = modwpt(wecg,'FullTree',true); p3 = wpt(packetlevels==3,:); plot(p3(3,:)) title('Level 3, Node 2 Wavelet Coefficients')
Try it in MATLAB
Display the center frequencies at level 3. cfreq(packetlevels==3,:) ans = 0.0312 0.0938 0.1562 0.2188 0.2812 0.3438 0.4062 0.4688
MODWPT Energy and Relative Energy
Obtain and plot the MODWPT energy and relative energy of an ECG waveform.
Try it in MATLAB
load wecg; [wpt,~,cfreq,energy,relenergy] = modwpt(wecg); Show that the sum of the MODWPT energies is equal to the sum of the energy in the original signal. The difference between the total MODWPT energy and the signal energy is small enough to be considered insignificant. sum(energy)-(bandpower(wecg)*length(wecg)) ans = 3.6120e-09 Plot the MODWPT energy by node. figure; bar(1:16,energy); xlabel('Node') ylabel('Energy') title('Energy by Node')
sprintf('Total power in passband is %.2f', energy(1)) ans = 'Total power in passband is 200.84' Plot the relative energy and show the percentage of signal energy in the first passband [0,5.6250]. figure; bar(1:16,relenergy*100); xlabel('Node'); ylabel('Percent Energy'); title('Energy Relative to Signal Energy by Node');
sprintf('Percentage of signal power in passband is %.1f',(relenergy(1)*100)) ans = 'Percentage of signal power in passband is 67.3'
Time-Aligned MODWPT
Obtain the time-aligned MODWPT of two intermittent sine waves in noise. The sine wave frequencies are 150 Hz and 200 Hz. The data is sampled at 1000 Hz. dt = 0.001; t = 0:dt:1-dt; x = cos(2*pi*150*t).*(t>=0.2 & t0.6 & t