默认阈值不行
%(信噪比 26.4401)图1
x=data(:,2);
x=x(274000:280000);
[c,l]=wavedec(x,4,'db4');
c4=appcoef(c,l,'db4',4); %低频系数
d3=detcoef(c,l,3);
d2=detcoef(c,l,2);
d1=detcoef(c,l,1);
d4=detcoef(c,l,4);
[thr1,sorh1,keepapp1]=ddencmp('den','wv',d1); %默认阈值
[thr2,sorh2,keepapp2]=ddencmp('den','wv',d2);
[thr3,sorh3,keepapp3]=ddencmp('den','wv',d3);
[thr4,sorh4,keepapp4]=ddencmp('den','wv',d4);
d1soft=wthresh(d1,sorh1,thr1); %阈值处理
d2soft=wthresh(d2,sorh2,thr2);
d3soft=wthresh(d3,sorh3,thr3);
d3soft=wthresh(d3,sorh3,thr3);
d4soft=wthresh(d4,sorh4,thr4);
c2=[c4',d1soft',d2soft',d3soft',d4soft'];
x3=waverec(c2,l,'db4');
snr1=SNR(x',x3)
plot(x,'-r')
hold on
plot(x3,'-b')
hold off
%(信噪比 26.8509)图2
x=data(:,2);
x=x(274000:280000);
[c,l]=wavedec(x,4,'db5');
c4=appcoef(c,l,'db5',4); %低频系数
d3=detcoef(c,l,3);
d2=detcoef(c,l,2);
d1=detcoef(c,l,1);
d4=detcoef(c,l,4);
[thr1,sorh1,keepapp1]=ddencmp('den','wv',d1); %默认阈值
[thr2,sorh2,keepapp2]=ddencmp('den','wv',d2);
[thr3,sorh3,keepapp3]=ddencmp('den','wv',d3);
[thr4,sorh4,keepapp4]=ddencmp('den','wv',d4);
d1soft=wthresh(d1,sorh1,thr1); %阈值处理
d2soft=wthresh(d2,sorh2,thr2);
d3soft=wthresh(d3,sorh3,thr3);
d3soft=wthresh(d3,sorh3,thr3);
d4soft=wthresh(d4,sorh4,thr4);
c2=[c4',d1soft',d2soft',d3soft',d4soft'];
x3=waverec(c2,l,'db5');
snr1=SNR(x',x3)
plot(x,'-r')
hold on
plot(x3,'-b')
hold off
%(信噪比 26.9347)图3
x=data(:,2);
x=x(274000:280000);
[c,l]=wavedec(x,4,'db6');
c4=appcoef(c,l,'db6',4); %低频系数
d3=detcoef(c,l,3);
d2=detcoef(c,l,2);
d1=detcoef(c,l,1);
d4=detcoef(c,l,4);
[thr1,sorh1,keepapp1]=ddencmp('den','wv',d1); %默认阈值
[thr2,sorh2,keepapp2]=ddencmp('den','wv',d2);
[thr3,sorh3,keepapp3]=ddencmp('den','wv',d3);
[thr4,sorh4,keepapp4]=ddencmp('den','wv',d4);
d1soft=wthresh(d1,sorh1,thr1); %阈值处理
d2soft=wthresh(d2,sorh2,thr2);
d3soft=wthresh(d3,sorh3,thr3);
d3soft=wthresh(d3,sorh3,thr3);
d4soft=wthresh(d4,sorh4,thr4);
c2=[c4',d1soft',d2soft',d3soft',d4soft'];
x3=waverec(c2,l,'db6');
snr1=SNR(x',x3)
plot(x,'-r')
hold on
plot(x3,'-b')
hold off
%(信噪比 30.6011)图4
x=data(:,2);
x=x(274000:280000);
[c,l]=wavedec(x,4,'db7');
c4=appcoef(c,l,'db7',4); %低频系数
d3=detcoef(c,l,3);
d2=detcoef(c,l,2);
d1=detcoef(c,l,1);
d4=detcoef(c,l,4);
[thr1,sorh1,keepapp1]=ddencmp('den','wv',d1); %默认阈值
[thr2,sorh2,keepapp2]=ddencmp('den','wv',d2);
[thr3,sorh3,keepapp3]=ddencmp('den','wv',d3);
[thr4,sorh4,keepapp4]=ddencmp('den','wv',d4);
d1soft=wthresh(d1,sorh1,thr1); %阈值处理
d2soft=wthresh(d2,sorh2,thr2);
d3soft=wthresh(d3,sorh3,thr3);
d3soft=wthresh(d3,sorh3,thr3);
d4soft=wthresh(d4,sorh4,thr4);
c2=[c4',d1soft',d2soft',d3soft',d4soft'];
x3=waverec(c2,l,'db7');
snr1=SNR(x',x3)
plot(x,'-r')
hold on
plot(x3,'-b')
hold off
%(信噪比 38.6749)图5
x=data(:,2);
x=x(274000:280000);
[c,l]=wavedec(x,3,'db7');
c3=appcoef(c,l,'db7',3); %低频系数
d3=detcoef(c,l,3);
d2=detcoef(c,l,2);
d1=detcoef(c,l,1);
[thr1,sorh1,keepapp1]=ddencmp('den','wv',d1); %默认阈值
[thr2,sorh2,keepapp2]=ddencmp('den','wv',d2);
[thr3,sorh3,keepapp3]=ddencmp('den','wv',d3);
d1soft=wthresh(d1,sorh1,thr1); %阈值处理
d2soft=wthresh(d2,sorh2,thr2);
d3soft=wthresh(d3,sorh3,thr3);
d3soft=wthresh(d3,sorh3,thr3);
c2=[c3',d1soft',d2soft',d3soft'];
x3=waverec(c2,l,'db7');
snr1=SNR(x',x3)
plot(x,'-r')
hold on
plot(x3,'-b')
hold off
%(信噪比 38.6383)图6
x=data(:,2);
x=x(274000:280000);
[c,l]=wavedec(x,3,'db6');
c3=appcoef(c,l,'db6',3); %低频系数
d3=detcoef(c,l,3);
d2=detcoef(c,l,2);
d1=detcoef(c,l,1);
[thr1,sorh1,keepapp1]=ddencmp('den','wv',d1); %默认阈值
[thr2,sorh2,keepapp2]=ddencmp('den','wv',d2);
[thr3,sorh3,keepapp3]=ddencmp('den','wv',d3);
d1soft=wthresh(d1,sorh1,thr1); %阈值处理
d2soft=wthresh(d2,sorh2,thr2);
d3soft=wthresh(d3,sorh3,thr3);
d3soft=wthresh(d3,sorh3,thr3);
c2=[c3',d1soft',d2soft',d3soft'];
x3=waverec(c2,l,'db6');
snr1=SNR(x',x3)
plot(x,'-r')
hold on
plot(x3,'-b')
hold off
%(信噪比 38.3868)图7
x=data(:,2);
x=x(274000:280000);
[c,l]=wavedec(x,3,'db5');
c3=appcoef(c,l,'db5',3); %低频系数
d3=detcoef(c,l,3);
d2=detcoef(c,l,2);
d1=detcoef(c,l,1);
[thr1,sorh1,keepapp1]=ddencmp('den','wv',d1); %默认阈值
[thr2,sorh2,keepapp2]=ddencmp('den','wv',d2);
[thr3,sorh3,keepapp3]=ddencmp('den','wv',d3);
d1soft=wthresh(d1,sorh1,thr1); %阈值处理
d2soft=wthresh(d2,sorh2,thr2);
d3soft=wthresh(d3,sorh3,thr3);
d3soft=wthresh(d3,sorh3,thr3);
c2=[c3',d1soft',d2soft',d3soft'];
x3=waverec(c2,l,'db5');
snr1=SNR(x',x3)
plot(x,'-r')
hold on
plot(x3,'-b')
hold off
%(信噪比 37.6715)图8
x=data(:,2);
x=x(274000:280000);
[c,l]=wavedec(x,3,'db4');
c3=appcoef(c,l,'db4',3); %低频系数
d3=detcoef(c,l,3);
d2=detcoef(c,l,2);
d1=detcoef(c,l,1);
[thr1,sorh1,keepapp1]=ddencmp('den','wv',d1); %默认阈值
[thr2,sorh2,keepapp2]=ddencmp('den','wv',d2);
[thr3,sorh3,keepapp3]=ddencmp('den','wv',d3);
d1soft=wthresh(d1,sorh1,thr1); %阈值处理
d2soft=wthresh(d2,sorh2,thr2);
d3soft=wthresh(d3,sorh3,thr3);
d3soft=wthresh(d3,sorh3,thr3);
c2=[c3',d1soft',d2soft',d3soft'];
x3=waverec(c2,l,'db4');
snr1=SNR(x',x3)
plot(x,'-r')
hold on
plot(x3,'-b')
hold off
%(信噪比 35.7357)图9
x=data(:,2);
x=x(274000:280000);
[c,l]=wavedec(x,3,'db3');
c3=appcoef(c,l,'db3',3); %低频系数
d3=detcoef(c,l,3);
d2=detcoef(c,l,2);
d1=detcoef(c,l,1);
[thr1,sorh1,keepapp1]=ddencmp('den','wv',d1); %默认阈值
[thr2,sorh2,keepapp2]=ddencmp('den','wv',d2);
[thr3,sorh3,keepapp3]=ddencmp('den','wv',d3);
d1soft=wthresh(d1,sorh1,thr1); %阈值处理
d2soft=wthresh(d2,sorh2,thr2);
d3soft=wthresh(d3,sorh3,thr3);
d3soft=wthresh(d3,sorh3,thr3);
c2=[c3',d1soft',d2soft',d3soft'];
x3=waverec(c2,l,'db3');
snr1=SNR(x',x3)
plot(x,'-r')
hold on
plot(x3,'-b')
hold off
%(信噪比 38.8400)图10
x=data(:,2);
x=x(274000:280000);
xwd=wden(x,'rigrsure','s','one',3,'sym4'); %小波
snr1=SNR(x,xwd)
plot(x,'-r')
hold on
plot(xwd,'-b')
hold off
%(信噪比 25.7375)图15
x=data(:,2);
x=x(274000:280000);
xwd=wden(x,'rigrsure','s','one',4,'sym4'); %小波
snr1=SNR(x,xwd)
plot(x,'-r')
hold on
plot(xwd,'-b')
hold off
%(信噪比 31.1308)图16
x=data(:,2);
x=x(274000:280000);
xwd=wden(x,'rigrsure','s','one',4,'db7'); %小波
snr1=SNR(x,xwd)
plot(x,'-r')
hold on
plot(xwd,'-b')
hold off
%(信噪比 40.2847)图17
x=data(:,2);
x=x(274000:280000);
xwd=wden(x,'rigrsure','s','one',3,'db7'); %小波
snr1=SNR(x,xwd)
plot(x,'-r')
hold on
plot(xwd,'-b')
hold off
%(信噪比 40.1414)图18
x=data(:,2);
x=x(274000:280000);
xwd=wden(x,'rigrsure','s','one',3,'db6'); %小波
snr1=SNR(x,xwd)
plot(x,'-r')
hold on
plot(xwd,'-b')
hold off
%(信噪比 39.8881)图19
x=data(:,2);
x=x(274000:280000);
xwd=wden(x,'rigrsure','s','one',3,'db5'); %小波
snr1=SNR(x,xwd)
plot(x,'-r')
hold on
plot(xwd,'-b')
hold off
%(信噪比 39.2726)图20
x=data(:,2);
x=x(274000:280000);
xwd=wden(x,'rigrsure','s','one',3,'db4'); %小波
snr1=SNR(x,xwd)
plot(x,'-r')
hold on
plot(xwd,'-b')
hold off
%图11信噪比 39.2726
x=data(:,2);
>> x=x(274000:280000);
>> [thr,sorh,keepapp]=ddencmp('den','wp',x); %小波包
xwpd=wpdencmp(x,'s',5,'db6','sure',thr,1);
snr1=SNR(x',xwpd)
plot(x,'-r')
hold on
plot(xwpd,'-b')
hold off
%图21信噪比 40.2847
x=data(:,2);
>> x=x(274000:280000);
>> [thr,sorh,keepapp]=ddencmp('den','wp',x); %小波包
xwpd=wpdencmp(x,'s',3,'db7','sure',thr,1);
snr1=SNR(x',xwpd)
plot(x,'-r')
hold on
plot(xwpd,'-b')
hold off
%图12 信噪比15.3276
x=data(:,2);
>> x=x(274000:280000);
>> [thr,sorh,keepapp]=ddencmp('den','wp',x); %小波包
xwpd=wpdencmp(x,'s',5,'db7','sure',thr,1);
snr1=SNR(x',xwpd)
plot(x,'-r')
hold on
plot(xwpd,'-b')
hold off
%图14 信噪比31.1308
x=data(:,2);
>> x=x(274000:280000);
>> [thr,sorh,keepapp]=ddencmp('den','wp',x); %小波包
xwpd=wpdencmp(x,'s',4,'db7','sure',thr,1);
snr1=SNR(x',xwpd)
plot(x