声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1182|回复: 0

[小波] 小波平移变量不变法的去噪

[复制链接]
发表于 2014-12-12 10:26 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
  • %%%%%%转载自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).'; % 源信号右平移
  • [z1,z2]=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('消噪后信号');

本帖被以下淘专辑推荐:

回复
分享到:

使用道具 举报

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-28 07:42 , Processed in 0.070770 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表