www.pudn.com > speechenhancement.rar > whpro.m


clear; 
close all; 
load('mtlb','mtlb'); 
M=length(mtlb); 
s=mtlb'; 
%M=input('input the length of signal>>>>>M='); 
n=1:M; 
%s=exp(-0.002*n).*sin(pi*n/50); 
w=0.5*randn(1,M);%try 0.1 0.4,1 
x=s+w; 
Rss=xcorr(s,s); 
Rww=xcorr(w,w); 
[h,e]=WH(Rss,Rww,M) 
ss=filter(h,2,x); 
subplot 221 
plot(n,s); 
title('Source signal'); 
subplot 222 
plot(n,w); 
title('noise'); 
subplot 223 
plot(n,x); 
title('Observated signal'); 
subplot 224 
plot(n,ss); 
title('Filtered signal'); 
figure; 
plot(n,ss-s); 
title('Error between filtered signal and Source signal')