你好,我在论坛上找了2个程序,可是它们的去噪效果都不好啊,一个的去噪程序是
t = [0:1/511:1]';
N=512;
T=1;
f0=20;
E = 1; %能量
snr_in_dB=-3;
snr = 10^(snr_in_dB/10); %信噪比
sigma = sqrt(E/(2*snr)); %噪声方差
x =E*cos(2*pi*(f0*t+K*t.^2/2));
x=x';
Noise = sigma * randn(1,N);%产生均值为0,方差为1的1*N的标准高斯分布的随机数
Noise = Noise * sigma/std(Noise);
ave_noise = mean(Noise);
while abs(ave_noise) > 0.01
Noise=1*sigma*randn(1,N);
Noise=Noise*sigma/std(Noise);
ave_noise = mean(Noise);
end
clear ave_noise
y=x+Noise;
%小波分解
[c,l]=wavedec(y,4,'db4');
[cd1,cd2,cd3,cd4]=detcoef(c,l,[1 2 3 4]);
ca4=appcoef(c,l,'db4',4);
a4=wrcoef('a',c,l,'db4',4);
d4=wrcoef('d',c,l,'db4',4);
d3=wrcoef('d',c,l,'db4',3);
d2=wrcoef('d',c,l,'db4',2);
d1=wrcoef('d',c,l,'db4',1);
%不需要的系数置零
% caa4=zeros(size(ca4));
%消噪后信号重构,并画图
cl=[ca4,cd4,cd3,cd2,cd1]; %
s2=waverec(cl,l,'db3');
figure(1);
subplot(2,1,1)
plot(t,x);
subplot(2,1,2)
plot(t,y,'g');
hold on
plot(t,s2,'r');title('消噪后重构信号');grid on;
[ 本帖最后由 lj2tt 于 2009-2-26 16:51 编辑 ] |