Open in the MATLAB editor: c09ea_example
function c09ea_example fprintf('c09ea example results\n\n'); m = int64(6); n = int64(6); wavnam = 'DB4'; mode = 'Half'; wtrans = 'Single level'; a = [8, 7, 3, 3, 1, 1; 4, 6, 1, 5, 2, 9; 8, 1, 4, 9, 3, 7; 9, 3, 8, 2, 4, 3; 1, 3, 7, 1, 5, 2; 4, 3, 7, 7, 6, 1]; fprintf('\nInput data a:\n'); disp(a); [nwl, nf, nwct, nwcn, icomm, ifail] = c09ab(wavnam, wtrans, mode, m, n); nwcm = double(nwct)/(4*double(nwcn)); % Perform Discrete Wavelet transform [ca, ch, cv, cd, ifail] = c09ea(a, icomm); fprintf('Approximation coefficients CA:\n'); disp(ca); fprintf('Diagonal coefficients CD:\n'); disp(cd); fprintf('Horizontal coefficients CH:\n'); disp(ch); fprintf('Vertical coefficients CV:\n'); disp(cv); % Reconstruct original data [b, ifail] = c09eb(m, n, ca, ch, cv, cd, icomm); fprintf('Reconstruction b:\n'); disp(b);
c09ea example results Input data a: 8 7 3 3 1 1 4 6 1 5 2 9 8 1 4 9 3 7 9 3 8 2 4 3 1 3 7 1 5 2 4 3 7 7 6 1 Approximation coefficients CA: 6.3591 10.3477 8.0995 10.3210 8.7587 3.5783 11.5754 6.3762 12.1704 7.4521 8.6977 14.8535 2.0630 8.4499 15.4726 12.1764 3.8920 2.7112 10.2143 6.2445 13.8571 8.1060 7.7701 13.2127 6.3353 8.7805 10.2727 10.0472 6.8614 7.5814 11.7141 11.1018 5.2923 8.1272 14.5540 2.5729 Diagonal coefficients CD: 0.4777 1.0230 -0.3147 0.0625 0.0831 -1.3316 1.0689 1.5671 -2.1422 0.5565 1.7593 -2.8097 -0.9555 -1.9276 0.9195 -0.2228 -0.5125 2.6989 0.2899 0.4453 -0.5695 0.1541 0.4749 -0.7946 0.4944 1.4145 0.3488 -0.1187 -0.6212 -1.5177 -1.3753 -2.5224 1.7581 -0.4316 -1.1835 3.7547 Horizontal coefficients CH: 0.4100 -0.1827 1.5354 0.0784 0.8101 -1.3594 2.3496 -0.9422 2.3780 -1.0540 2.7743 -2.2648 -1.2690 0.0152 -6.9338 -1.7435 -1.6917 1.2388 0.6317 -0.0969 2.3300 0.4637 0.6365 -0.1162 -0.2343 0.3923 5.5457 2.1818 0.2103 -0.8573 -1.8880 0.8142 -4.8552 0.0736 -2.7395 3.3590 Vertical coefficients CV: 1.5365 5.9678 3.4309 -1.0585 -5.0275 -4.8492 0.6779 -0.0294 -5.3274 1.6483 4.8689 -1.8383 -1.1065 -2.8791 0.1535 0.0982 0.8417 2.8923 -0.1359 -2.6633 -5.8549 1.8440 6.2403 0.5697 1.4244 5.2140 1.6410 -0.4669 -3.2369 -4.5757 1.0288 2.2521 0.0574 -0.1359 -0.5170 -2.6854 Reconstruction b: 8.0000 7.0000 3.0000 3.0000 1.0000 1.0000 4.0000 6.0000 1.0000 5.0000 2.0000 9.0000 8.0000 1.0000 4.0000 9.0000 3.0000 7.0000 9.0000 3.0000 8.0000 2.0000 4.0000 3.0000 1.0000 3.0000 7.0000 1.0000 5.0000 2.0000 4.0000 3.0000 7.0000 7.0000 6.0000 1.0000