

function [peakAmp, maxFreq]=waveletTrial(signal,param)
    

    len = length(signal);
    level = 6;

    [C,L] = wavedec(signal,level,'db5');
    D1 = wrcoef('d',C,L,'db5',1);
    D2 = wrcoef('d',C,L,'db5',2);
    D3 = wrcoef('d',C,L,'db5',3) ;
    D4 = wrcoef('d',C,L,'db5',4);
    D5 = wrcoef('d',C,L,'db5',5);
    A5 = wrcoef('a',C,L,'db5',5);

    D1 = wdenoise(D1,"wavelet","db5");
    D2 = wdenoise(D2,"wavelet","db5");
    D3 = wdenoise(D3,"wavelet","db5");
    D4 = wdenoise(D4,"wavelet","db5");
    D5 = wdenoise(D5,"wavelet","db5");
    A5 = wdenoise(A5,"wavelet","db5");


    [f,signal_fft] = FFT(signal,param);
    [f1,D1_fft] = FFT(D1,param);
    [peakAmp{1}, maxFreq{1}] = findpeaks(D1_fft,f1);
    [f2,D2_fft] = FFT(D2,param);
    [peakAmp{2}, maxFreq{2}] = findpeaks(D2_fft,f2);
    [f3,D3_fft] = FFT(D3,param);
    [peakAmp{3}, maxFreq{3}] = findpeaks(D3_fft,f3);    
    [f4,D4_fft] = FFT(D4,param);
    [peakAmp{4}, maxFreq{4}] = findpeaks(D4_fft,f4);
    [f5,D5_fft] = FFT(D5,param);
    [peakAmp{5}, maxFreq{5}] = findpeaks(D5_fft,f5);
    [f6,D5a_fft] = FFT(A5,param);
    [peakAmp{6}, maxFreq{6}] = findpeaks(D5a_fft,f6);

    
    N = param.samplerange;
    t = linspace(param.startsec,param.endsec,N);

    figure
    subplot(6,2,1)
    plot(t,signal,'k')
    title('signal')
    xlabel("time(s)")

    subplot(6,2,2)
    plot(f,signal_fft,'k')
    title('signal fft')
    xlabel("frequency(Hz)")

    subplot(6,2,3)
    plot(t,D5,'b')
    title('D^5')
    xlabel("time(s)")

    subplot(6,2,4)
    plot(f5,D5_fft,'b')
    title('D^5 fft')
    xlabel("frequency(Hz)")

    subplot(6,2,5)
    plot(t,D4,'b')
    title('D^4')
    xlabel("time(s)")

    subplot(6,2,6)
    plot(f4,D4_fft,'k')
    title('D^4 fft')
    xlabel("frequency(Hz)")

    subplot(6,2,7)
    plot(t,D3,'r')
    title('D^3')
    xlabel("time(s)")

    subplot(6,2,8)
    plot(f3,D3_fft,'k')
    title('D^3 fft')
    xlabel("frequency(Hz)")

    subplot(6,2,9)
    plot(t,D2,'b')
    title('D^2')
    xlabel("time(s)")

    subplot(6,2,10)
    plot(f2,D2_fft,'k')
    title('D^2 fft')
    xlabel("frequency(Hz)")

    subplot(6,2,11)
    plot(t,D1,'r')
    title('D^1')
    xlabel("time(s)")

    subplot(6,2,12)
    plot(f1,D1_fft,'k')
    title('D^1 fft')
    xlabel("frequency(Hz)")


    figure
    subplot(2,1,1)
    plot(t,A5,'b')
    title('D^6')
    xlabel("time(s)")

    subplot(2,1,2)
    plot(f6,D5a_fft,'b')
    title('D^5 a fft')
    xlabel("frequency(Hz)")

end