This function calculates discrete wavelet transform (one-level wavelet decomposition) of the input signal, u. Before transformation, the original signal is extended at both ends with zero padding. The length of the two result vectors is floor((size(u,1)+size(lod,1)-1)/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 dwt input Real u[:] = {1, 2, 1, 2, 1, 2, 3, 4, 1} "Signal to be analyzed"; 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 ca[:] "Approximation coefficients, size(ca,1) = ceil(size(u,1)/2)"; output Real cd[size(ca, 1)] "Detail coefficients"; end dwt;