永发信息网

跪求MATLAB小波软硬阈值图象去噪的代码

答案:2  悬赏:10  手机版
解决时间 2021-03-08 04:04
  • 提问者网友:眉目添风霜
  • 2021-03-08 00:50
跪求MATLAB小波软硬阈值图象去噪的代码
最佳答案
  • 五星知识达人网友:孤老序
  • 2021-03-08 01:36
%设置信噪比和随机种子值
snr=4;
init=2055615866;
%产生原始信号sref和高斯白噪声污染的信号s
[sref,s]=wnoise(1,11,snr,init);
%用db1小波对原始信号进行3层分解并提取系数
[c,l]=wavedec(s,3,'db1');
a3=appcoef(c,l,'db1',3);
d3=detcoef(c,l,3);
d2=detcoef(c,l,2);
d1=detcoef(c,l,1);
thr=1;
%进行硬阈值处理
ythard1=wthresh(d1,'h',thr);
ythard2=wthresh(d2,'h',thr);
ythard3=wthresh(d3,'h',thr);
c2=[a3 ythard3 ythard2 ythard1];
s3=waverec(c2,l,'db1');
%进行软阈值处理
ytsoftd1=wthresh(d1,'s',thr);
ytsoftd2=wthresh(d2,'s',thr);
ytsoftd3=wthresh(d3,'s',thr);
c3=[a3 ytsoftd3 ytsoftd2 ytsoftd1];
s4=waverec(c3,l,'db1');
%对上述信号进行图示
subplot(5,1,1);plot(sref);title('参考信号');
subplot(5,1,2);plot(s);title('染噪信号');
subplot(5,1,3);plot(s3);title('硬阈值处理');
subplot(5,1,4);plot(s4);title('软阈值处理');
全部回答
  • 1楼网友:零点过十分
  • 2021-03-08 02:35
- -不是吧现在都没人回答么……
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯