2
$\begingroup$

The Wavelet Matrix, also called the Haar matrix, is very useful. We can find some useful information in MathWorld on how to generate it, but this document is too hard for me. From my reading of the Wiki page, maybe KroneckerProduct can be of help. Can anybody make it a custom function?

$\endgroup$
  • $\begingroup$ @Young Can generate this matrix? $\endgroup$ – yode Jul 5 '16 at 1:36
  • $\begingroup$ Arndt's Matters Computational has a prolly more understandable discussion. $\endgroup$ – J. M. will be back soon Jul 5 '16 at 2:16
  • $\begingroup$ Yode, as it stands your question reads as a request for others to do your work. Perhaps you could at least make the question self-contained by including a definition of this matrix, its properties, and an example. You should also show what you have tried so far that hasn't worked for you. $\endgroup$ – MarcoB Jul 5 '16 at 4:03
  • $\begingroup$ @MarcoB I'm sorry.And thanks for your direction.It's a pity I cannot find a good regulation about this matrix up to now result in I don't know how to give the first try.If I have,I'll add it in the post. $\endgroup$ – yode Jul 5 '16 at 9:06
5
$\begingroup$

Update-2:

More compact version proposed by J. M. with the matrix normalized:

steps = 3; (*order = 2^step*)
h = Nest[Join[KroneckerProduct[#, {1, 1}], 
              KroneckerProduct[IdentityMatrix[Length[#]], {1, -1}]] &, {{1}}, steps];
Orthogonalize[h] // MatrixForm

enter image description here

Update-1:

Creates un-normalized Haar matrix for $\text{order} = 2^n$.

steps = 3; (*order = 2^step*)

h = {{1, 1}, {1, -1}}; (*2x2*)
Do[
 hn = KroneckerProduct[h, {1, 1}];
 hi = KroneckerProduct[IdentityMatrix[Length[h]], {1, -1}];
 h = Join[hn, hi]
 , (steps-1)]
h // MatrixForm

enter image description here

$\endgroup$
  • $\begingroup$ Thanks for you useful answer.but my original intention is getting that Wavelet Matrix.:) $\endgroup$ – yode Jul 5 '16 at 1:54
  • $\begingroup$ Thanks for your heavy work for me,which make me deeply move... $\endgroup$ – yode Jul 5 '16 at 9:08
  • $\begingroup$ Just a little confusion.Cannot we build a any order haar matrix? $\endgroup$ – yode Jul 5 '16 at 9:10
  • 3
    $\begingroup$ Slightly more compact: Nest[Join[KroneckerProduct[#, {1, 1}], KroneckerProduct[IdentityMatrix[Length[#]], {1, -1}]] &, {{1, 1}, {1, -1}}, 2] $\endgroup$ – J. M. will be back soon Jul 5 '16 at 10:24
  • 1
    $\begingroup$ If normalization is desired, Orthogonalize[] does it in one blow. $\endgroup$ – J. M. will be back soon Jul 5 '16 at 18:36

Your Answer

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

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