Illustration of the use of programs to compute the forward and inverse transform using the FFT.
Ivan Selesnick, Polytechnic Institute, Brooklyn, New York. November 2008
The dilation factor is q/p. Given q/p, s influences the Q-factor, redundancy, and ringing. J is the number of levels. p, q, s, J should all be non-negative integers and p < q. Also, p, q, s should be chosen so that the redundancy > 1. I usually use p = q-1.
clear close all addpath radwt_functions_v2 % or use 'radwt_functions_v1' addpath extra_functions % Uncomment one of the following two lines: % p = 5; q = 6; s = 2; J = 10; % High Q-factor wavelet transform p = 2; q = 3; s = 1; J = 8; % Low Q-factor wavelet transform redundancy = 1/s * 1/(1-p/q) % Must be greater than 1
redundancy = 3.0000
Verify PR for analysis and synthesis filter banks
N = 7*q*s; % Signal length [H,G] = MakeFreqResp(N,p,q,s); % Make frequency responses x = rand(1,N); % Make test signal [lo,hi] = afb(x, H, G, p, q, s); % Analysis filter bank y = sfb(lo, hi, H, G, p, q, s); % Synthesis filter bank y = y(1:N); % Reconstructed signal max(abs(x - y)) % Error should be zero
ans = 4.4409e-16
Make sure that the wavelet transform perfectly reconstructs the signal x. Verify PR for various signal lengths.
for N = 220:230 % Test signals of various lengths x = rand(1,N); % Make test signal w = radwt(x,J,p,q,s); % Forward overcomplete rational WT y = iradwt(w,p,q,s); % Inverse overcomplete rational WT y = real(y(1:N)); % Reconstructed signal e = max(abs(x - y)); % Error should be zero disp(e) end
1.7764e-15 1.8874e-15 1.6653e-15 1.2212e-15 1.7764e-15 1.4433e-15 1.8874e-15 1.6653e-15 1.8874e-15 1.2212e-15 1.6653e-15
Display the wavelets for the first several levels.
N = 250; % Length of signal J1 = 1; J2 = J; figure(1) PlotWavelets(N,p,q,s,J1,J2); orient tall print -dpdf figures/demo1_wavelets % Print figure to file
figure(2) subplot(2,1,1) Plot_FreqResps(p,q,s,J) print -dpdf figures/demo1_freq_resps