MATLAB Examples

Tunable Q-factor Wavelet Transform: Verify PR

Verify perfect reconstruction (PR) property of TQWT

```% Reference: 'Wavelet Transform with Tunable Q-Factor' % http://taco.poly.edu/selesi/TQWT/ % Ivan Selesnick, selesi@poly.edu % Polytechnic Institute of NYU % November 2010 clear for k = 1:2 if k == 1 Q = 4; r = 3; J = 10; % High Q-factor wavelet transform elseif k == 2 Q = 1; r = 3; J = 5; % Low Q-factor wavelet transform end fprintf('\n') fprintf('Q = %3.2f, r = %3.2f\n',Q,r) beta = 2/(Q+1); alpha = 1-beta/r; I = sqrt(-1); % Verify PR for N = 400:2:420 % Verify PR for various lengths x = rand(1,N) + I*rand(1,N); % Make test signal (complex-valued) J = floor(log2(beta*N/8)/log2(1/alpha)); % number of levels w = tqwt(x,Q,r,J); % TQWT y = itqwt(w,Q,r,N); % Inverse TQWT recon_err = max(abs(x - y)); % Reconstruction error % print reconstruction error: fprintf('N = %4d, J = %3d: tqwt/itqwt recon error = %e\n',N,J,recon_err) end end ```
```Q = 4.00, r = 3.00 N = 400, J = 20: tqwt/itqwt recon error = 5.661049e-16 N = 402, J = 20: tqwt/itqwt recon error = 1.439118e-15 N = 404, J = 21: tqwt/itqwt recon error = 1.522577e-15 N = 406, J = 21: tqwt/itqwt recon error = 7.850462e-16 N = 408, J = 21: tqwt/itqwt recon error = 9.420555e-16 N = 410, J = 21: tqwt/itqwt recon error = 8.455207e-16 N = 412, J = 21: tqwt/itqwt recon error = 1.391105e-15 N = 414, J = 21: tqwt/itqwt recon error = 8.326673e-16 N = 416, J = 21: tqwt/itqwt recon error = 7.550333e-16 N = 418, J = 21: tqwt/itqwt recon error = 7.850462e-16 N = 420, J = 21: tqwt/itqwt recon error = 8.005932e-16 Q = 1.00, r = 3.00 N = 400, J = 9: tqwt/itqwt recon error = 8.881784e-16 N = 402, J = 9: tqwt/itqwt recon error = 1.665335e-15 N = 404, J = 9: tqwt/itqwt recon error = 1.531343e-15 N = 406, J = 9: tqwt/itqwt recon error = 9.036561e-16 N = 408, J = 9: tqwt/itqwt recon error = 7.850462e-16 N = 410, J = 9: tqwt/itqwt recon error = 7.499144e-16 N = 412, J = 9: tqwt/itqwt recon error = 1.341488e-15 N = 414, J = 9: tqwt/itqwt recon error = 6.938894e-16 N = 416, J = 9: tqwt/itqwt recon error = 8.920730e-16 N = 418, J = 9: tqwt/itqwt recon error = 9.155134e-16 N = 420, J = 9: tqwt/itqwt recon error = 6.776000e-16 ```