3
$\begingroup$

I'd like to ask when we apply Wavelet transform on 1-D Signal in Matlab it simply stores both Approximations and Details into a single row which is quite annoying for me,

have a look,

enter image description here

Where,

X = original Signal cDn = Details coefficients cAn = Approximations

This is how Matlab do it,

Suppose I have a random sequence,

X=[2 2 3 100 4 0 98 100 90 2 3 67 98 0 6 6 89 9 21 78]

If I apply 2-level Wavelet transform on this signal it will be decomposed in to cA1 and cD1. cA1 will then further decomposed into cA2 and cD2. But matlab will store all these A's and D's into a single row. Have a look what matlab will do to the resultant coefficients after performing Wavelet Transform on it.

X = 20 Samplesc  -> cD1 = 10 Samples
                    cA1 = 10 Samples
                                     -> cD2 = 5 Samples
                                        cA2 = 5 Samples

Rows = 1 Columns = 20

Column 1 to 5 = cA2 Column 6 to 10 = cD2 Column 11 to 20 = cD1

Why Matlab does that ? Why it doesn't decompose signal in Rows since that would be easier to represent.

$\endgroup$
2
  • $\begingroup$ Related: dsp.stackexchange.com/q/651/29 $\endgroup$
    – endolith
    Mar 8, 2013 at 15:40
  • $\begingroup$ pywavelet's wavedec outputs multiple arrays, for comparison: [array([ 145.25, 197. ]), array([ 9.25, 0. ]), array([-33.5876, 18.3848, 0. ]), array([-49.5, -97. , 11. , 43. , -0.5]), array([ 0. , -68.5894, 2.8284, -1.4142, 62.2254, -45.2548, 69.2965, 0. , 56.5685, -40.3051])] $\endgroup$
    – endolith
    Mar 9, 2013 at 0:28

1 Answer 1

2
$\begingroup$

You can use the function dwt instead that does single-level decomposition and use that again for 2-level decomposition. Personally, I use wavedec all the time, I actually find it easy to have it in one array. Boils down to personal preferences I guess.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.