songjie2895 发表于 2012-6-4 09:51

加性噪声的小波去噪的问题

下面是我自己的加噪(加的是高斯白噪声)和小波去噪程序,去噪效果不理想,大家帮我看看是不是我小波去噪的参数选择的不对,谢谢诸位了
clc;
close all;
clear all;

%源信号
p1=30;p2=50;         %frequencies of s1
p3=60;               %frequencies of s2
SigLen=512;            %length of the sources
points=512;            %number of represented points
m=2;n=2;               %m为源数,n为观测信号数
s1=sin(*p1*2*pi/SigLen)+sin(*p2*2*pi/SigLen);   %源信号s1
s2=sin(*p3*2*pi/SigLen);                                    %源信号s2
s=;             %源信号矩阵
for i=1:n
    s(i,:)=s(i,:)-mean(s(i,:));         %中心化(去均值)
    s(i,:)=s(i,:)/std(s(i,:));            %normalization of the source signals
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%观测信号
A11=1;A22=1;A12=-0.72222;A21=-0.59447;
A=;                      %混合矩阵A
X=A*s;                                    %观测信号X
subplot(3,2,1),plot(X(1,:),'MarkerEdgeColor','k','MarkerFaceColor','k');%观测信号x1的图形
title('观测信号 1');
set(gca,'xlim',),set(gca,'xtick',);
subplot(3,2,2),plot(X(2,:),'MarkerEdgeColor','k','MarkerFaceColor','k')   %观测信号x2的图形
title('观测信号 2');
set(gca,'xlim',),set(gca,'xtick',);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%noise on signal 1:
snr1=-30;               %信噪比为-30db
X_noised(1,:)=zeros(1,length(X(1,:)));
X_noised(1,:)=awgn(X(1,:),snr1);
subplot(3,2,3),plot(X_noised(1,:),'MarkerEdgeColor','k','MarkerFaceColor','k');
title('加噪观测信号 1');
set(gca,'xlim',),set(gca,'xtick',);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%noise on signal 2:
snr2=-20;               %信噪比为-20db
X_noised(2,:)=zeros(1,length(X(2,:)));
X_noised(2,:)=awgn(X(2,:),snr2);
subplot(3,2,4),plot(X_noised(2,:),'MarkerEdgeColor','k','MarkerFaceColor','k');
title('加噪观测信号 2');
set(gca,'xlim',),set(gca,'xtick',);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%对观测信号进行小波阈值消噪

X_denoised=zeros(n,SigLen);
TPTR_before='heursure';          %threshold selection rule
thresholding_before='s';         %阈值选择
Lev_before=2;                  %小波的分解层数
Wname='sym6';                  %wavelet basis

%对第一个含噪观测信号X_noised(1,:)进行小波阈值消噪

=wden(X_noised(1,:),TPTR_before,thresholding_before,'sln',Lev_before,Wname);
X_denoised(1,:)=xd;
subplot(3,2,5),plot(X_denoised(1,:),'MarkerEdgeColor','k','MarkerFaceColor','k');   %估计消噪后观测信号X_denoised1的图形
title('小波消噪后观测信号 1');
set(gca,'xlim',),set(gca,'xtick',);

%对第二个含噪观测信号X_noised(2,:)进行小波阈值消噪

=wden(X_noised(2,:),TPTR_before,thresholding_before,'sln',Lev_before,Wname);
X_denoised(2,:)=xd;
subplot(3,2,6),plot(X_denoised(2,:),'MarkerEdgeColor','k','MarkerFaceColor','k');   %估计消噪后观测信号X_denoised2的图形
title('小波消噪后观测信号 2');
set(gca,'xlim',),set(gca,'xtick',);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

wtsnake 发表于 2012-12-24 11:38

你为啥不直接用matlab小波工具箱里的函数呢
页: [1]
查看完整版本: 加性噪声的小波去噪的问题