# How to generate a Wavelet Matrix?

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?

• @Young Can generate this matrix? – yode Jul 5 '16 at 1:36
• Arndt's Matters Computational has a prolly more understandable discussion. – J. M. will be back soon Jul 5 '16 at 2:16
• 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. – MarcoB Jul 5 '16 at 4:03
• @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. – yode Jul 5 '16 at 9:06

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


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


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