高分请教!小波去噪的matlab程序,在线等~~~~~~~~~~~

2024-11-19 19:27:47
推荐回答(1个)
回答1:

供参考:
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') %加入的重构,是不是你要的?