This function carries out multi-level wavelet decomposition.
Parameter, len, is a vector with (N+2) elements, where N is the number of levels. It contents the length information of the coefficients in all levels. len[1] is the length of the original signal vector; len[2] is the length of the detail coefficient vector of the first decomposition level; len[3] is the length of the detail coefficient vector of the second decomposition level; and so forth. Finally, len[N+2] contains the length of the approximation coefficient vector. Parameter, c, contains the wavelet coefficients of all levels, firstly the first detail level, then the second detail level and so on, and finally the approximation coefficients. This is described again in detail as follows:
Data | Length | Location |
Original signal | len[1] | u |
First level detail coefficients | len[2] | c[1 : len[2]] |
Second level detail coefficients | len[3] | c[len[2]+1 : len[2]+len[3]] |
... | ... | ... |
k-th level detail coefficients | len[k+1] | c[sum(len[2:k])+1 : sum(len[2:k+1])] |
... | ... | ... |
N-th level detail coefficients | len[N+1] | c[sum(len[2:N])+1 : sum(len[2:N+1])] |
Approximation coefficients | len[N+2] | c[sum(len[2:N+1])+1 : sum(len[2:N+2])] |
Refer to the section of wavelet Families for the detailed information about the available wavelets.
The default input values provide a quick example with a simple saw-tooth signal.
function wavDec input Real u[:] = {1, 2, 1, 2, 1, 2, 3, 4, 1, 2, 3, 4, 1} "Signal to be analyzed"; input Integer N = 3 "Decomposition level"; input Real lod[:] = {0.707, 0.707} "Low pass filter for decomposition"; input Real hid[size(lod, 1)] = {-0.707, 0.707} "High pass filter for decomposition"; output Real c[:] "Detail and approximation coefficients. For data structure see the information section"; output Integer len[N + 2] "Lengths of the coefficient vectors of all levels. For data structure see the information section"; end wavDec;