1
$\begingroup$

I am trying to use Mathematica's wavelet transform. In preparation I entered:

n = 8
Clear[dataTest]
dataTest = Table[0, {n}]
For [i = 1, i < n + 1, i++,
 dataTest[[i]] = i;
 ]
dataTest
wave2 = DaubechiesWavelet[2]
dwd = DiscreteWaveletTransform[dataTest, wave2]
dwd[All]

and had output:

...
{{0} -> {10.0382, 2.31079, 5.13922, 7.96764, 10.0382}, 
 {1} -> {-2.82843, 4.44089*10^-16, 0., 0., -2.82843}, 
 {0, 0} -> {14.1962, 6.90192, 10.0981, 13.0981}, 
 {0, 1} -> {4., -1.36603, 1.09808, -4.09808}, 
 {0, 0, 0} -> {18.1226, 13.1982, 18.1226}, 
 {0, 0, 1} -> {4.2993, -1.26282, 4.2993}}

When I calculate the transform by hand I obtain:

{0} -> {2.31079, 5.13922, 7.96764, 10.0382},...,
{0, 0} -> {5.901923789, 12.09807621},...,
{0, 0, 0} -> {12.72792206}

In addition to the numerical differences, I thought {0} should have 4 values, {0, 0} should have 2 values and {0, 0, 0} should have 1 value for input data of dimension 8. Can anyone help me understand the discrepancies?

In addition I tried input data of dimension 4:

n = 4
Clear[dataTest]
dataTest = Table[0, {n}]
For [i = 1, i < n + 1, i++,
 dataTest[[i]] = i;
 ]
dataTest
wave2 = DaubechiesWavelet[2]
dwd = DiscreteWaveletTransform[dataTest, wave2]
dwd[All]
dwd["EnergyFraction"]

resulting in output:

... {{0} -> {4.76028, 2.31079, 4.76028}, {1} -> {-1.41421, 4.44089*10^-16, -1.41421}, {0, 0} -> {5.86603, 4.68301, 6.18301}, {0, 1} -> {1.5, 0.549038, -2.04904}}

{{1} -> 0.0379793, {0, 1} -> 0.0640901, {0, 0} -> 0.897931}

The input energy is 1*1+2*2+3*3+4*4=30. Consequently the last line cannot be correct since the EnergyFraction for {1} should be (1.41421*1.41421)/30 = 2/(30) = 0.066666667, definitely NOT 0.0379793. Alternately, note that (1.41421*1.41421)/(0.0379793) = 52.66026, which is significantly greater than the input energy.

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$ – bbgodfrey Oct 2 '15 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.