wavelet based denoising at sub band level

Embed Size (px)

DESCRIPTION

code

Citation preview

clc, close all, clear all[pure, fs] = wavread('road.wav'); amp = 4;pure = amp*pure; N = length(pure);snr = 5;noisy = awgn(pure,snr,'measured');%----------------------------------------------------- ASSUMES TO BE THE INPUT SIGNAL% [C,L] = wavedec(noisy,4,'db4');%[C,L] = dwt(noisy,'db4');[ca1, D1]= dwt(noisy,'db4');%D1= detcoef(C,L,1);%-----------------------------------------------extracts the detailcoefficients at level 1 from the waveletdecomposition structure [C,L]d=find(D1)==0;%ca1=appcoef(C,L,'db4',1);%----------------------------------------------------------------------------- 2ND LEVEL OF DECOMPOSITION OF ca1 signal next ca2 signal[C2,L2] = dwt(ca1,'db4');D2=detcoef(C2,L2,1);ca2=appcoef(C2,L2,'DB4',1);% % PDF with bounded support% p.lB=0;% p.uB=1;% fhandle=figure;% gkdeb(C2,p);[muhat,sigmahat] = normfit(D2); xval = D2; [mu,sigma] = normfit(D2); yval = normpdf(xval,mu,sigma); %plot(xval,yval)% get actual kernel density.[F1,xi] = ksdensity(C2); % figure(1)figure(1),plot(xi,F1);% axis([-0.9 0.9 0 1.3]);xlabel('amplitude--D2');ylabel('density function');title(' Gkernel density funtn scale2');%--------------------------------------------2nd level cauchy distributioncD2=sort(D2,'ascend');c11D2=median(cD2);j=1;m=1;for i=1: length(cD2); if cD2(i)