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?
-
$\begingroup$ @Young Can generate this matrix? $\endgroup$– yodeJul 5, 2016 at 1:36
-
$\begingroup$ Arndt's Matters Computational has a prolly more understandable discussion. $\endgroup$– J. M.'s persistent exhaustion ♦Jul 5, 2016 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$– MarcoBJul 5, 2016 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$– yodeJul 5, 2016 at 9:06
1 Answer
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
-
$\begingroup$ Thanks for you useful answer.but my original intention is getting that Wavelet Matrix.:) $\endgroup$– yodeJul 5, 2016 at 1:54
-
$\begingroup$ Thanks for your heavy work for me,which make me deeply move... $\endgroup$– yodeJul 5, 2016 at 9:08
-
$\begingroup$ Just a little confusion.Cannot we build a any order haar matrix? $\endgroup$– yodeJul 5, 2016 at 9:10
-
3$\begingroup$ Slightly more compact:
Nest[Join[KroneckerProduct[#, {1, 1}], KroneckerProduct[IdentityMatrix[Length[#]], {1, -1}]] &, {{1, 1}, {1, -1}}, 2]
$\endgroup$ Jul 5, 2016 at 10:24 -
1$\begingroup$ If normalization is desired,
Orthogonalize[]
does it in one blow. $\endgroup$ Jul 5, 2016 at 18:36