The Wavelet Digest Homepage
Return to the homepage
Search the complete Wavelet Digest database
Help about the Wavelet Digest mailing list
About the Wavelet Digest
The Digest The Community
 Latest Issue  Back Issues  Events  Gallery
The Wavelet Digest
   -> Volume 2, Issue 14


Mathematica wavelet packets programs.
 
images/spacer.gifimages/spacer.gif Reply into Digest
Previous :: Next  
Author Message
Mladen Victor Wickerhauser, Washington University.
Guest





PostPosted: Fri Nov 29, 2002 3:36 pm    
Subject: Mathematica wavelet packets programs.
Reply with quote

Mathematica wavelet packets programs.

Here are some old Mathematica programs to generate individual wavelet packets
and to calculate inner products with individual wavelet packets. The one
example I have provided is intended to be a template: change the relevant
parameters, or the sequence of filters, to get any wavelet packet you wish.

I hereby put this code into the public domain.

Cheers, Victor

Professor Mladen Victor Wickerhauser <victor@math.wustl.edu>
Department of Mathematics, Campus Box 1146, One Brookings Drive,
Washington University in Saint Louis, Missouri 63130 USA
Telephone: USA+(314)935-6771; Facsimile: USA+(314)935-5799

(* ----------------->8 Cut here 8<---------------------*)
(* Wave Packets and Modulated Pulses *)
(* M. Victor Wickerhauser *)
(* 21 May 1990 *)

(* FILTER COEFFICIENTS *)
(* We start with some standard conjugate quadrature filters: *)

stdH[10] = {0.160102397974, 0.603829269797, 0.724308528438,
0.138428145901, -0.242294887066, -0.032244869585,
0.077571493840, -0.006241490213, -0.012580751999,
0.003335725285};

std[12] = { 0.111540743350, 0.494623890398, 0.751133908021, 0.315250351709,
-0.226264693965, -0.129766867567, 0.097501605587, 0.027522865530,
-0.031582039318, 0.000553842201, 0.004777257511, -0.001077301085};

coif[12] = {1.15875967387, -.02932013798, -.04763959031,
.273021046535, .574682393857, .294867193696, -.0540856070917,
-.0420264804608, .0167444101633, .00396788361296,-.00128920335614,
-.000509505399};

sr15 = Sqrt[15.0];
coif[6] = {(sr15-3.0)/32.0,(1.0-sr15)/32.0,(3.0-sr15)/16.0,(sr15+3.0)/16.0,
(sr15+13.0)/32.0,(9.0-sr15)/32.0};

mirrorFilter[ filter_ ] :=
Block[{len},
len = Length[filter];
Table[ (-1)^n filter[[len+1-n]], {n,1,len}]
]


(* CONVOLUTION AND DECIMATION *)
(* Define the convolution decimation operators convolveDecimate[] as a
function of two arguments: filter list, and vector list: *)

convolveDecimate[filter_, vector_]:=
Block[{vectorLength,filterRange},
vectorLength = Length[vector];
filterRange = Length[filter];
Table[
Sum[ filter[[j]] vector[[Mod[2i+j-3,vectorLength]+1]],
{i,1,filterRange}
],
{i,1,vectorLength/2}
]
]

(* The adjoint of this operation is similarly defined: *)

antiConvolve[filter_, vector_]:=
Block[{tempVec, newLength, filterRange, vectorLength},
vectorLength = Length[vector];
filterRange = Length[filter];
newLength = 2 vectorLength;
tempVec = Table[0,{i,1, newLength}]; (* initialize output *)
Do[
tempVec[[ Mod[2j+i-3,newLength]+1 ]] += vector[[j]] filter[[i]],
{j,1,vectorLength},
{i,1,filterRange}
];
tempVec
]

(* MAKING WAVELETS AND WAVELET PACKETS *)
(* Now we can anticonvolve a wavelet of length 512: *)

H = coif[6]; G = mirrorFilter[H];

w1 = antiConvolve[ H,
antiConvolve[ H,
antiConvolve[ H,
antiConvolve[ H,
antiConvolve[ H,
antiConvolve[ G,{1,0,0,0,0,0,0,0}]
]
]
]
]
];


ListPlot[w1,PlotRange->{-.05,.05},PlotJoined->True]

(* Wavelet packets are similarly made with other sequences of filters: *)

wp1 = antiConvolve[ H,
antiConvolve[ G,
antiConvolve[ H,
antiConvolve[ G,
antiConvolve[ G,
antiConvolve[ G,{1,0,0,0,0,0,0,0}]
]
]
]
]
];

ListPlot[wp1,PlotRange->{-.05,.05},PlotJoined->True]
All times are GMT + 1 Hour
Page 1 of 1

 
Jump to: 
 


disclaimer - webmaster@wavelet.org
Powered by phpBB

This page was created in 0.025539 seconds : 18 queries executed : GZIP compression disabled