声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1092|回复: 0

[小波] 小波消噪遇到的问题

[复制链接]
发表于 2010-9-15 11:02 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
我运用下面的代码进行小波消噪,为什么用硬阈值得到的信噪比反而比用软阈值得到的信噪比大?请大家帮忙指正,不胜感激。谢谢。下面是代码
clear;
load noisbump;
NX= noisbump;
N=length(NX);
wname='sym4';%选sym4小波基
lev=4;%4层分解4
[c,l]=wavedec(NX,lev,wname);
a4=appcoef(c,l,wname,lev);
d4=detcoef(c,l,4);
d3=detcoef(c,l,3);
d2=detcoef(c,l,2);
d1=detcoef(c,l,1);
cD=[d1,d2,d3,d4];
sigma=median(abs(NX))/0.6745;
thr(1)=sigma*sqrt(2*log(N))/log(1+1);
thr(2)=sigma*sqrt(2*log(N))/log(2+1);
thr(3)=sigma*sqrt(2*log(N))/log(3+1);
thr(4)=sigma*sqrt(2*log(N))/log(4+1);
cD1=wthresh(d1,'s',thr(1));
cD2=wthresh(d2,'s',thr(2));
cD3=wthresh(d3,'s',thr(3));
cD4=wthresh(d4,'s',thr(4));
cd=[a4, cD4,cD3,cD2,cD1];
c=cd;
XD=waverec(c,l,wname);
figure(1);
subplot(2,2,1);
plot(NX);
ylabel('幅值 A');
title('加噪信号');
subplot(2,2,2);
plot(XD);
title('软阈值处理') ;
[c,l]=wavedec(NX,lev,wname);
a4=appcoef(c,l,wname,lev);
d4=detcoef(c,l,4);
d3=detcoef(c,l,3);
d2=detcoef(c,l,2);
d1=detcoef(c,l,1);
cD=[d1,d2,d3,d4];
sigma=median(abs(NX))/0.6745;
thr(1)=sigma*sqrt(2*log(N))/log(1+1);
thr(2)=sigma*sqrt(2*log(N))/log(2+1);
thr(3)=sigma*sqrt(2*log(N))/log(3+1);
thr(4)=sigma*sqrt(2*log(N))/log(4+1);
cD1=wthresh(d1,'h',thr(1));
cD2=wthresh(d2,'h',thr(2));
cD3=wthresh(d3,'h',thr(3));
cD4=wthresh(d4,'h',thr(4));
cd=[a4, cD4,cD3,cD2,cD1];
c=cd;
yh=waverec(c,l,wname);
subplot(2,2,3);
plot(yh);
ylabel('幅值 A');
title('硬阈值处理');
y1=sum((NX).^2) ;
yys= sum ((XD-NX).^2);
yyh= sum ((yh-NX).^2);

snrys=10*log10((y1/yys));%软阈值去噪信号信噪比
fprintf('软阈值去噪信号信噪比%4.4f\n',snrys);
snryh=10*log10((y1/yyh));%硬阈值去噪信号信噪比
fprintf('硬阈值去噪信号信噪比%4.4f\n',snryh);

回复
分享到:

使用道具 举报

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-19 04:37 , Processed in 0.052896 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表