This example shows how to obtain and plot the detail coefficients for an electrical current signal. This example uses zero-padding (see dwtmode).
Load the signal and select the first 3920 samples.
origmode = dwtmode('status','nodisplay');
dwtmode('zpd','nodisplay')
load leleccum;
s = leleccum(1:3920);
Perform the decomposition at level 3 using db1. Extract the detail coefficients at levels 1, 2, and 3 from the decomposition structure.
[c,l] = wavedec(s,3,'db1');
[cd1,cd2,cd3] = detcoef(c,l,[1 2 3]);
Plot the original signal.
plot(s)
title('Original signal')
ylim([0 1000])
Plot the level 3 detail coefficients.
plot(cd3)
title('Level 3 detail coefficients (cd3)')
ylim([-60 60])
Plot the level 2 detail coefficients.
plot (cd2)
title('Level 2 detail coefficients (cd2)')
ylim([-60 60])
Plot the level 1 detail coefficients.
plot (cd1)
title('Level 1 detail coefficients (cd1)')
ylim([-60 60])
Restore the original extension mode.
dwtmode(origmode,'nodisplay')