1-D detail coefficients
returns a cell array containing the detail coefficients. A minimum of two levels
must be specified. The ith element
D = detcoef(
D contains the detail coefficients at the
ith specified level.
D = detcoef(C,L,N)is equivalent to
D = detcoef(C,L,N,'cells').
D = detcoef(C,L,'cells')is equivalent to
D = detcoef(C,L,[1:NMAX]), where
NMAX = length(L)-2.
Detail Coefficients for 1-D Signal
This example shows how to obtain and plot the detail coefficients for an electrical current signal. This example uses zero-padding (see
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.
C — Wavelet decomposition vector
Wavelet decomposition vector, specified as a real-valued vector. The
C is the output of
Complex Number Support: Yes
L — Bookkeeping vector
vector of positive integers
Bookkeeping vector, specified as a vector of positive integers. The
L contains the number of
coefficients by level. The bookkeeping vector is used to parse the
coefficients in the wavelet decomposition vector
L are the outputs of
N — Detail level
positive integer | vector of positive integers
Detail level to extract from the wavelet decomposition, specified as a positive integer or a vector of positive integers.
Nis an integer, then
Nmust be an integer such that
1 ≤ N ≤ NMAX, where
NMAX = length(L)-2.
Nis a vector of integers, then
N(j)must be an integer such that
1 ≤ N(j) ≤ NMAX, where
j = 1,…,length(N).
D — Detail coefficients
real-valued vector | cell array
Detail coefficients, returned as a real-valued vector or a cell array. If
D is a cell array, the
ith element of
D are the detail coefficients at the level
specified by the ith element
D1,…,Dp — Detail coefficients
Detail coefficients, returned as set of real-valued vectors. The
ith output argument are
the detail coefficients at the level specified by the corresponding element
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
Usage notes and limitations:
'per'extension modes are supported. See
detcoefsupports only these syntaxes:
D = detcoef(C,L)
D = detcoef(C,L,N)