KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > DougJamesDau2


1 import JSci.maths.*;
2 import JSci.maths.wavelet.*;
3 import JSci.maths.wavelet.daubechies2.*;
4
5 /********************************************
6 * This class illustrates how to do
7 * signal processing with daubechies 2 wavelets
8 * @author Daniel Lemire
9 *********************************************/

10 public class DougJamesDau2 {
11         public static void main(String JavaDoc[] arg) {
12                 // wavelet
13
Daubechies2 ondelette = new Daubechies2();
14
15                 // signal data
16
double[] data=new double[32];
17                 for(int k=0;k<data.length;k++) {
18                         data[k]=k;
19                 }
20                 Signal signal = new Signal(data);
21
22                 // transform
23
signal.setFilter(ondelette);
24                 int level=1;
25                 FWTCoef sCoef = signal.fwt(level); // for some level int
26
ArrayMath.print(sCoef.getCoefs()[0]);
27                 ArrayMath.print(sCoef.getCoefs()[1]);
28
29                 /******************************
30                 * We now have to check if we
31                 * can get the signal back!
32                 *******************************/

33                 ArrayMath.print(sCoef.rebuildSignal(ondelette).evaluate(0));
34         }
35 }
36
37
Popular Tags