This is my programmatic note 15 on Ch. 04, p. 31-34, in "Ripples in Mathematics"
by A. Jensen & A. la Cour-Harbo. These notes document my
programmatic journey, sometimes easy, sometimes
painful, but always joyful, through this great text. My notes
are for those who want to use Java as a programming
investigation tool of various wavelet algorithms and Octave for plotting
the
results. You can find my previous notes by searching my blog on "ripples
in mathematics." If you are on the same journey, let me know of any
bugs in my code or improvements you have found that let us all, fellow
travelers on the wavelet road, get better and more beautiful results.
In this note, I cover my programmatic multiresolution analysis of a chirp, i.e., a signal obtained from sampling sin(t^2) in exercise 4.3 on p. 33. The multiresolution analysis is done on a chirp of size 512 with CDF44 and HWT obtained over 4 scales.
In this note, I cover my programmatic multiresolution analysis of a chirp, i.e., a signal obtained from sampling sin(t^2) in exercise 4.3 on p. 33. The multiresolution analysis is done on a chirp of size 512 with CDF44 and HWT obtained over 4 scales.
Multiresolution Analysis of Y=SIN(T^2)
The class that generates the range of sin(t^2) is defined in Ripples_F_ex_4_3_p33.java. Fig. 1 gives a graph of this signal on [0, 511] created by the Octave script ex_4_3_chirp_512_p33.m.
Figure 1. Graph of y = sin(t^2) on [0, 511] |
static void multires_ex_4_3_hwt_p33(String message, int range_start, int range_end, int signal_size, int num_scales) {
double[] chirp_signal = generate_chirp(signal_size);
ApplyDWT.forwardDWTForNumIters(chirp_signal, ApplyDWT.DWT.HWT, num_scales, range_start, range_end);
double[] signal = new double[signal_size];
for(int i = 0; i < signal_size; i++) {
if ( i >= range_start && i <= range_end ) {
signal[i] = chirp_signal[i];
}
else {
signal[i] = 0;
}
}
System.out.println("=========================");
System.out.println(message);
display_signal(signal);
System.out.println("Inversed Signal");
System.out.println("=========================");
ApplyDWT.inverseDWTForNumIters(signal, ApplyDWT.DWT.HWT, num_scales);
display_signal(signal);
System.out.println("=========================");
}
static void multires_ex_4_3_cdf44_p33(String message, int range_start, int range_end, int signal_size, int num_scales) {
double[] chirp_signal = generate_chirp(signal_size);
//CDF44.orderedDWTForNumIters(chirp_signal, num_scales, false);
ApplyDWT.forwardDWTForNumIters(chirp_signal, ApplyDWT.DWT.CDF44, num_scales, range_start, range_end);
double[] signal = new double[signal_size];
for(int i = 0; i < signal_size; i++) {
if ( i >= range_start && i <= range_end ) {
signal[i] = chirp_signal[i];
}
else {
signal[i] = 0;
}
}
System.out.println("=========================");
System.out.println(message);
display_signal(signal);
System.out.println("Inversed Signal");
System.out.println("=========================");
//CDF44.orderedInverseDWTForNumIters(signal, num_scales, false);
ApplyDWT.inverseDWTForNumIters(signal, ApplyDWT.DWT.CDF44, num_scales);
display_signal(signal);
System.out.println("=========================");
}
Below are the graphed parts of the multiresolution analysis along with the Java methods from RipplesInMathCh04.java that generated their values. All graphs are generated by the Octave scripts in this repo with self-explanatory names, e.g., ex_4_3_chirp_512_CDF44_D8_p33.m. The graphs for D7 and D6 are skipped.
D8 Graphs
static void ex_4_3_chirp_512_cdf44_d8_p33() { multires_ex_4_3_cdf44_p33("Ex. 4.3, CDF44, D8, p. 33", D8_START_512, D8_END_512, 512, 4); }
Figure 2. CDF(4, 4), D8, 4 scales |
static void ex_4_3_chirp_512_hwt_d8_p33() { multires_ex_4_3_hwt_p33("Ex. 4.3, HWT, D8, p. 33", D8_START_512, D8_END_512, 512, 4); }
Figure 3. HWT, D8, 4 scales |
D5 Graphs
static void ex_4_3_chirp_512_cdf44_d5_p33() { multires_ex_4_3_cdf44_p33("Ex. 4.3, CDF44, D5, p. 33", D5_START_512, D5_END_512, 512, 4); }
Figure 8. CDF(4, 4), D5, 4 scales |
static void ex_4_3_chirp_512_hwt_d5_p33() { multires_ex_4_3_hwt_p33("Ex. 4.3, HWT, D5, p. 33", D5_START_512, D5_END_512, 512, 4); }
Figure 9. HWT, D5, 4 scales |
S5 Graphs
static void ex_4_3_chirp_512_cdf44_s5_p33() { multires_ex_4_3_cdf44_p33("Ex. 4.3, CDF44, S5, p. 33", S5_START_512, S5_END_512, 512, 4); }
Figure 10. CDF(4, 4), S5, 4 scales |
static void ex_4_3_chirp_512_hwt_s5_p33() { multires_ex_4_3_hwt_p33("Ex. 4.3, HWT, S5, p. 33", S5_START_512, S5_END_512, 512, 4); }
Figure 11. HWT, S5, 4 scales |