clear all;
close all;
clc;
t=0:0.01:1;
f=5;
x=square(2*pi*f*t);
addnoise=0.8*randn(size(t))
y= x + addnoise;
for i=1:101
if (y(i)<0)
y2(i)=-1;
else
y2(i)=1;
end
end
thresh1=0.5;
thresh2=-0.5;
flag1=1;
flag2=0;
for i=1:101;
if flag1==1
if y(i)<thresh2;
y3(i)=-1;
flag1=0;
flag2=1;
else
y3(i)=1;
end
elseif flag2==1;
if y(i)>thresh1
y3(i)=1;
flag1=1;
falg2=0;
else
y3(i)=-1;
end
end
end
tlength=length(t);
PowerS=sum((x).^2)/tlength;
PowerGuassianN=sum((addnoise).^2)/tlength;
PowerNoise1=sum((y2-x).^2)/tlength;
PowerNoise2=sum((y3-x).^2)/tlength;
figure;
plot(t,y,t,y2,t,0);
figure;
plot(t,y,t,y3,t,thresh1,t,thresh2);
SNR1=10*log(PowerS/PowerNoise1)
SNR2=10*log(PowerS/PowerNoise2)
matlabwaveletthreshod.zip_hard thresholding_matlab去噪_小波去噪_硬阈值_软阈
版权申诉
192 浏览量
2022-07-15
03:40:50
上传
评论
收藏 560B ZIP 举报
weixin_42651887
- 粉丝: 80
- 资源: 1万+
评论0