Hi Sara,
I understand that you have queries regarding the wavedec function of MATLAB. You are correct in understanding that the wavedec function in MATLAB inherently uses a dyadic scale for the Discrete Wavelet Transform (DWT). This means that the function automatically applies the dyadic scaling (doubling of scale at each level) and translation as part of its algorithm.
When the wavedec function is used for decomposing a signal, the dyadic scaling is a fundamental part of the DWT algorithm. The function decomposes the signal into various frequency bands using wavelets, where each subsequent decomposition level halves the frequency band, effectively doubling the scale. This is in line with the DWT's nature, where:
- At level 0, you have the original signal.
- At level 1, the signal is decomposed into approximation (low-frequency) and detail (high-frequency) components.
- At level 2 and beyond, the process continues on the approximation component from the previous level, each time halving the frequency band (or doubling the scale).
The scale (j) and translation (m) parameters in the context of the wavedec function are implicitly defined by the level of decomposition and the position within each level's output. For a given level j, the scale is 2^j, and the translation parameter m varies across the coefficients within that level.
- Scale (j): The decomposition level directly indicates the scale. For example, level 1 corresponds to j=1 (scale=2^1), level 2 to j=2 (scale=2^2), and so on.
- Translation (m): Within each level, the coefficients represent different translations. The exact value of m is not typically exposed directly by the wavedec function, as the focus is on the hierarchical decomposition of the signal into frequency bands rather than on specific translations. However, the position of a coefficient within a level's output array can be thought of as corresponding to different values of m.
In practical applications using wavedec as given by this MATLAB R2024a documentation link: https://www.mathworks.com/help/wavelet/ref/wavedec.html , the j and m parameters are not usually calculated for each coefficient. Instead, the computations involve the entire array of coefficients at each level. To analyze or modify specific details at a given scale, the coefficients for that level are interacted with as a whole. Please follow this example MATLAB code that illustrates the use of wavedec function:
[coeffs, L] = wavedec(x, 3, 'db1')
coeffs =
-0.3581 0.3266 -0.2811 0.2841 -0.5406 1.7822 -0.4293 -2.1417 -0.0270 0.9468 -0.4727 0.3215 -1.0821 0.1427 0.4713 0.9605 -0.4029 0.0143 0.5013 -0.6212 0.2318 1.7458 0.3475 1.6297 -0.4535 -1.5772 0.2934 -0.2019 1.1865 -0.2088
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
L =
128 128 256 512 1024
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
approxLevel3 = coeffs(1:L(1))
approxLevel3 =
-0.3581 0.3266 -0.2811 0.2841 -0.5406 1.7822 -0.4293 -2.1417 -0.0270 0.9468 -0.4727 0.3215 -1.0821 0.1427 0.4713 0.9605 -0.4029 0.0143 0.5013 -0.6212 0.2318 1.7458 0.3475 1.6297 -0.4535 -1.5772 0.2934 -0.2019 1.1865 -0.2088
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
detailLevel1 = coeffs(end-L(end)+1:end)
detailLevel1 =
-0.3581 0.3266 -0.2811 0.2841 -0.5406 1.7822 -0.4293 -2.1417 -0.0270 0.9468 -0.4727 0.3215 -1.0821 0.1427 0.4713 0.9605 -0.4029 0.0143 0.5013 -0.6212 0.2318 1.7458 0.3475 1.6297 -0.4535 -1.5772 0.2934 -0.2019 1.1865 -0.2088
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
In this example, the scale and translation are implicitly managed by wavedec and the structure of coeffs and L. The level of decomposition (e.g., 3 levels) directly informs you about the scale used (2^j for each level j), and the coefficients within each level represent different translations, though the exact m values are abstracted away.
I hope this helps!