Open in the MATLAB editor: c09da_example
function c09da_example fprintf('c09da example results\n\n'); % 1d maximal overlap discrete wavelet decomposition using a Daubechies wavelet n = int64(8); x = [1 3 5 7 6 4 5 2]; wavnam = 'DB4'; mode = 'Periodic'; wtrans = 'Time invariant'; % Setup for wavelet [nwlmax, nf, nwc, icomm, ifail] = c09aa(wavnam, wtrans, mode, n); % Compute decomposition [ca, cd, icomm, ifail] = c09da(x, nwc, icomm); disp('Approximation coefficients:') fprintf('%8.4f',ca); fprintf('\n'); disp('Detail coefficients:') fprintf('%8.4f',cd); fprintf('\n'); % Reconstruct [y, ifail] = c09db(ca, cd, n, icomm); disp('Reconstruction:') fprintf('%8.4f',y); fprintf('\n');
c09da example results Approximation coefficients: 2.7781 1.5146 2.2505 4.8788 6.6845 6.3423 4.7869 3.7644 Detail coefficients: -0.6187 0.6272 0.1883 -1.1966 1.2618 0.3354 -0.3314 -0.2660 Reconstruction: 1.0000 3.0000 5.0000 7.0000 6.0000 4.0000 5.0000 2.0000