lev=5
[c,l]=wavedec(x,lev,wname)
sigma=wnoisest(c,l,1)
alpha=2
thr1=wbmpen(c,l,sigma,alpha)
[thr2,nkeep]=wdcbm(c,l,alpha)
xd1=wdencmp('gbl',c,l,wname,lev,thr1,'s',1)
[xd2,cxd,lxd,perf0,perfl2]=wdencmp('lvd',c,l,wname,lev,thr2,'h')
[thr,sorh,keepapp]=ddencmp('den','wv',x)
xd3=wdencmp('gbl',c,l,wname,lev,thr,'s',1)
subplot(411)plot(x)title('原始信号','fontsize',12)
subplot(412)plot(xd1)title('使用penalty阈值降噪后信号','fontsize',12)
subplot(413)plot(xd2)title('使用Birge-Massart阈值降噪后信号','fontsize',12)
subplot(414)plot(xd3)title('使用缺省阈值降噪后信号','fontsize',12)
s=[-1.58
0.42
0.46
0.78
-0.49
0.59
-1.3
-1.42
-0.16
-1.47
-1.35
0.36
-0.44
-0.14
1
-0.5
-0.2
-0.06
-0.6
0.42
-1.52
0.51
0.76
-1.5
0.16
-1.29
-0.65
-1.48
0.6
-1.65
-0.55]
[C,L]=wavedec(s,1,'db3')
ca1=wrcoef('a',C,L,'db3'棚誉轮,1)
x1=ca1
[C,L]=wavedec(s,2,'db3')
ca2=wrcoef('a',C,L,'db3',2)
x2=ca2
[C,L]=wavedec(s,3,'db3')
ca3=wrcoef('a',C,L,'db3',3)
x3=ca3
[C,L]=wavedec(s,4,'db3')
ca4=wrcoef('a',C,L,'db3',4)
x4=ca4
cg
=
wrcoef('a',C,L,'sym5',1)
x5=cg
p=1:31
subplot(6,1,1)plot(p,s)ylabel('s')
subplot(6,1,2)plot(p,x1)ylabel('链信ca1')
subplot(6,1,3)plot(p,x2)ylabel('ca2')
subplot(6,1,4)plot(p,x3)ylabel('虚弊ca3')
subplot(6,1,5)plot(p,x4)ylabel('ca4')
subplot(6,1,6)plot(p,x5)ylabel('ca5')
%加入的重构,是不是你要的?
fs=44100[x,fs,bits]=wavread('ding11.wav')
%sound(x)
t=0:(size(x)-1)
x2=rand(1,length(x))' %产生一与x长高裤州度一致的随机信号
y=x+x2
%加入正弦噪声
t=0:(n-1)
Au=0.03
d=[Au*sin(2*pi*500*t)]'
y=x+d
wp=0.25*pi
ws=0.3*pi
wdelta=ws-wp
N=ceil(6.6*pi/wdelta) %取整
wn=(0.2+0.3)*pi/2
b=fir1(N,wn/pi,hamming(N+1)) %选择窗函数,并归一化截止频率
figure(1)
freqz(b,1,512)
f2=filter(bz,az,y)
figure(2)
subplot(2,1,1)
plot(t,y)
title('滤波前的时域波形')
subplot(2,1,2)
plot(t,f2)
title('滤波后的时域波形戚蔽')
sound(f2) %播放滤波后的语音信号
F0=fft(f1,1024)
f=fs*(0:511)/1024
figure(3)
y2=fft(y,1024)
subplot(2,1,1)
plot(f,abs(y2(1:512)))%画出滤波前的频谱图
title('滤波前纯坦的频谱')
xlabel('Hz')
ylabel('fuzhi')
subplot(2,1,2)
F1=plot(f,abs(F0(1:512))) %画出滤波后的频谱图
title('滤波后的频谱')
xlabel('Hz')
ylabel('fuzhi')
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)