PROBLEM 2 PART 2: Use wavekit to do transformation and compare >> function wavekitHaar(f) [h, g]=wavecoef('Haar'); w = fwt1(f,h,g) end; >> x1=[1 0 0 0 0 0 0 0] x1 = 1 0 0 0 0 0 0 0 >> wavekitHaar(x1) w = 0.3536 0.3536 0.5000 0 0.7071 0 0 0 >> x2=[1 1 1 1 1 1 1 1] x2 = 1 1 1 1 1 1 1 1 >> wavekitHaar(x2) w = 2.8284 0 0 0 0 0 0 0 >> x3=[1 -1 1 -1 1 -1 1 -1]; >> wavekitHaar(x3) w = 0 0 0 0 1.4142 1.4142 1.4142 1.4142 >> x4=[1 1 1 1 -1 -1 -1 -1]; >> wavekitHaar(x4) w = 0 2.8284 0 0 0 0 0 0 PART 3: %function to compare fft and fwt1 for Hallelujah function chrpcomp t = 0 : 65536; [h,g] = wavecoef('coi', 24); load('handel.mat') hallelujah=y(1:65536); chrpcomf fixpos subplot(241); title('Hallelujah'); subplot(242); title('Fourier transform'); subplot(243); title('Wavelet basis'); subplot(244); title('Best wavelet packet basis'); drawnow watchon; subplot(241); plot(1:65536,hallelujah); axis square title('Hallelujah'), xlabel('time') drawnow subplot(242); plot(1:65536,fft(hallelujah)); axis square title('Fourier transform'), xlabel('frequency') drawnow subplot(243); w1 = wpa1(hallelujah,h,g); phasepln(wavbasis(w1),h,g) title('Wavelet basis'), xlabel('time'), ylabel('frequency') drawnow subplot(244); phasepln(bestbase(w1),h,g) title('Best wavelet packet basis'), xlabel('time'), ylabel('frequency') drawnow watchoff; set(gcf, 'handlevisibility', 'callback')