小波平移变量不变法的去噪
[*]%%%%%%转载自http://forum.vibunion.com/thread-9141-2-1.html
[*]clear;
[*]clc; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[*]%% 1.原始信号 f=50; % 信号频率
[*]fs=800; % 采样频率
[*]N=128; % 采样点 % 信号赋值
[*]n=1:N;
[*]y=sin(2*pi*f*n/fs); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[*]%% 2.噪声
[*]noise=0.4*rand(1,128); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[*]%% 3.染噪信号
[*]y_noise=y+noise; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[*]%% 4.硬消噪采用cycle_spinning技术 % 累加量
[*]z5=zeros(1,N); % 平移变换频移法
[*]for i=1:N;
[*]z=circshift(y_noise.',i-1).'; % 源信号右平移
[*]=lwt(z,'db3'); % 小波正变换
[*]z2=zeros(1,N/2); % 高频分量全部为零(主要噪声,硬消噪)
[*]z3=ilwt(z1,z2,'db3'); % 小波反变换
[*]z4=circshift(z3.',-(i-1)).'; % 变换后信号左平移
[*]z5=z5+z4/N; % 平均
[*]end;
[*]
[*]%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[*]%% 5.显示 error=norm(y-z5)/norm(y); % 相对误差 figure(1);
[*]subplot(2,1,1)
[*]plot(y,'r');
[*]legend('源信号');
[*]subplot(2,1,2);
[*]plot(y_noise);
[*]legend('染噪信号');
[*]figure(2);
[*]subplot(2,1,1)
[*]plot(y,'r');
[*]legend('源信号');
[*]title(error);
[*]subplot(2,1,2);
[*]plot(z5);
[*]legend('消噪后信号');
页:
[1]