Open in the MATLAB editor: c09cb_example
function c09cb_example fprintf('c09cb example results\n\n'); n = int64(8); wavnam = 'DB4'; mode = 'zero'; wtrans = 'Single Level'; x = [1; 3; 5; 7; 6; 4; 5; 2]; fprintf('\n Input Data:\n'); fprintf('%8.4f ', x); fprintf('\n'); % Query wavelet filter dimensions [nwl, nf, nwc, icomm, ifail] = c09aa(wavnam, wtrans, mode, n); if ifail == int64(0) % Compute the transform [ca, cd, icomm, ifail] = c09ca(x, nwc, icomm); if ifail == int64(0) fprintf(' Approximation coefficients CA :\n'); fprintf('%8.4f ', ca); fprintf('\n'); fprintf(' Detail coefficients CD :\n'); fprintf('%8.4f ', cd); fprintf('\n'); % Reconstruct original data [y, ifail] = c09cb(ca, cd, n, icomm); if ifail == int64(0) fprintf(' Reconstruction Y : \n'); fprintf('%8.4f ', y); fprintf('\n'); end end end
c09cb example results Input Data: 1.0000 3.0000 5.0000 7.0000 6.0000 4.0000 5.0000 2.0000 Approximation coefficients CA : 0.0011 -0.0043 -0.0174 4.4778 8.9557 7.3401 2.5816 Detail coefficients CD : 0.0237 0.0410 -0.5966 1.7763 -0.7517 0.3332 -0.1188 Reconstruction Y : 1.0000 3.0000 5.0000 7.0000 6.0000 4.0000 5.0000 2.0000