EEMD去噪算法

news/2025/2/22 21:29:24/

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档

文章目录

  • 前言
  • 一、EEMD去噪
  • 二、使用步骤
    • 1.代码展示
    • 2.function [spmax, spmin, flag]= extrema(in_data)
    • 2.functi代码如下(示例):
  • 结果展示


前言

提示:这里可以添加本文要记录的大概内容:

例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。


提示:以下是本篇文章正文内容,下面案例可供参考

一、EEMD去噪

EEMD方法的本质是一种叠加高斯白噪声的多次经验模式分解,利用了高斯白噪声具有频率均匀分布的统计特性,通过每次加入同等幅值的不同白噪声来改变信号的极值点特性,之后对多次EMD得到的相应IMF进行总体平均来抵消加入的白噪声,从而有效抑制模态混叠的产生。EEMD分解步骤如下:
(1)设定总体平均次数M;
(2)将一个具有标准正态分布的白噪声加到原始信号上,以产生多个新的信号:在这里插入图片描述

式中表示第i次加性白噪声序列,表示第i次试验的附加噪声信号;
(3)对所得含噪声的信号分别进行EMD分解,得到各自和的形式:

式中,为第i次加入白噪声后分解得到的第j个imf;是残余函数;J的IMF数量;
在这里插入图片描述

(4)重复步骤(2)和步骤(3)进行M次,每次分解加入幅值不同的白噪声信号得到的集合为:在这里插入图片描述

(5)利用不相关序列的统计平均值为零的原理, 将上述对应的进行集合平均运算,得到EEMD分解后最终的,即:
在这里插入图片描述

式中是EEMD分解的第j个IMF。

二、使用步骤

1.代码展示

代码如下(示例):

clc;
clear;
close all;
tic;
%% 产生仿真信号
fs=100;   %数据采样率Hz
t=1:1/fs:4096*1/fs; %对数据进行采样
n = length(t);  %数据的采样数目
f1 =0.25; %信号的频率
f2=0.005;x=8*sin(2*pi*f1*t+cos(2*pi*f2*t))+10*cos(0.43*t);x=x';    %产生原始信号,将其转置为列向量
nt=3*randn(n,1);  %高斯白噪声生成
y=x+nt; %含噪信号figure(1);
subplot(2,1,1);plot(x);title('原始信号');xlabel('采样点数');ylabel('幅值');
subplot(2,1,2);plot(y);title('含噪信号');xlabel('采样点数');ylabel('幅值');
%% EEMD分解Nstd=0.2*std(y);
NE=30;
imf=eemd(y,Nstd,NE);
figure(2);
% IMF1是原始输入信号y,IMF2-IMF7是从高频到低频的IMF分量,IMF8是残余分量
subplot(4,2,1); plot(imf(:,1));title('IMF1');xlabel('采样点数');ylabel('幅值');
subplot(4,2,2); plot(imf(:,2));title('IMF2');xlabel('采样点数');ylabel('幅值');
subplot(4,2,3); plot(imf(:,3));title('IMF3');xlabel('采样点数');ylabel('幅值');
subplot(4,2,4); plot(imf(:,4));title('IMF4');xlabel('采样点数');ylabel('幅值');
subplot(4,2,5); plot(imf(:,5));title('IMF5');xlabel('采样点数');ylabel('幅值');
subplot(4,2,6); plot(imf(:,6));title('IMF6');xlabel('采样点数');ylabel('幅值');
subplot(4,2,7); plot(imf(:,7));title('IMF7');xlabel('采样点数');ylabel('幅值');
subplot(4,2,8); plot(imf(:,8));title('IMF8');xlabel('采样点数');ylabel('幅值');
imf=imf(:,2:8);
n=7;
r=zeros(1,n);
for i=1:n% 求相关系数r(1,i)=sum((y-mean(y)).*(imf(:,i)-mean(imf(:,i))),1)./sqrt(sum(((y-mean(y)).^2),1).*sum(((imf(:,i)-mean(imf(:,i))).^2),1));
end
% 求标准差
d=std(r);
[M,I] = max(r);
% 信号的重构
yt=imf(:,I);
figure(3);
plot(yt);
hold on;
plot(x);
title('去噪信号与原始信号');xlabel('采样点数');ylabel('幅值');
toc;
% figure(1)
% width=400;%宽度,像素数
% height=250;%高度
% left=200;%距屏幕左下角水平距离
% bottem=100;%距屏幕左下角垂直距离
% set(gcf,'position',[left,bottem,width,height])
% plot(i,afz','-*','LineWidth',2)
% %xlim([0 100]);
%  xlabel('故障宽度 e-3','FontSize',10.5);ylabel('幅值/(m/s^2)','FontSize',10.5)
% title('峰值');

2.function [spmax, spmin, flag]= extrema(in_data)

代码如下(示例):

% 这是一个用于显著性检验的实用程序.
%
%   function [spmax, spmin, flag]= extrema(in_data)
%
% INPUT:
%       in_data: Inputted data, a time series to be sifted(被筛选);
% OUTPUT:
%       spmax: The locations (col 1) of the maxima and its corresponding
%              values (col 2)
%       spmin: The locations (col 1) of the minima and its corresponding
%              values (col 2)
%
% References can be found in the "Reference" section.
%
% The code is prepared by Zhaohua Wu. For questions, please read the "Q&A" section or
% contact
%   zwu@fsu.edu
%
function [spmax, spmin, flag]= extrema(in_data)flag=1;
dsize=length(in_data);spmax(1,1) = 1;
spmax(1,2) = in_data(1);
jj=2;
kk=2;
while jj<dsizeif ( in_data(jj-1)<=in_data(jj) && in_data(jj)>=in_data(jj+1) )spmax(kk,1) = jj;spmax(kk,2) = in_data (jj);kk = kk+1;endjj=jj+1;
end
spmax(kk,1)=dsize;
spmax(kk,2)=in_data(dsize);if kk>=4slope1=(spmax(2,2)-spmax(3,2))/(spmax(2,1)-spmax(3,1));tmp1=slope1*(spmax(1,1)-spmax(2,1))+spmax(2,2);if tmp1>spmax(1,2)spmax(1,2)=tmp1;endslope2=(spmax(kk-1,2)-spmax(kk-2,2))/(spmax(kk-1,1)-spmax(kk-2,1));tmp2=slope2*(spmax(kk,1)-spmax(kk-1,1))+spmax(kk-1,2);if tmp2>spmax(kk,2)spmax(kk,2)=tmp2;end
elseflag=-1;
endmsize=size(in_data);
dsize=max(msize);
xsize=dsize/3;
xsize2=2*xsize;spmin(1,1) = 1;
spmin(1,2) = in_data(1);
jj=2;
kk=2;
while jj<dsizeif ( in_data(jj-1)>=in_data(jj) && in_data(jj)<=in_data(jj+1))spmin(kk,1) = jj;spmin(kk,2) = in_data (jj);kk = kk+1;endjj=jj+1;
end
spmin(kk,1)=dsize;
spmin(kk,2)=in_data(dsize);if kk>=4slope1=(spmin(2,2)-spmin(3,2))/(spmin(2,1)-spmin(3,1));tmp1=slope1*(spmin(1,1)-spmin(2,1))+spmin(2,2);if tmp1<spmin(1,2)spmin(1,2)=tmp1;endslope2=(spmin(kk-1,2)-spmin(kk-2,2))/(spmin(kk-1,1)-spmin(kk-2,1));tmp2=slope2*(spmin(kk,1)-spmin(kk-1,1))+spmin(kk-1,2);if tmp2<spmin(kk,2)spmin(kk,2)=tmp2;end
elseflag=-1;
endflag=1;

2.functi代码如下(示例):

function allmode=eemd(Y,Nstd,NE)
xsize=length(Y);
dd=1:1:xsize; 
Ystd=std(Y);
Y=Y/Ystd;    %part2.evaluate TNM as total IMF number,ssign 0 to N*TNM2 matrix
TNM=fix(log2(xsize))-5;   % TNM=m
TNM2=TNM+2;               
for kk=1:1:TNM2for ii=1:1:xsizeallmode(ii,kk)=0.0;  end
end%part3 Do EEMD -----EEMD loop start
for iii=1:1:NE %EEMD loop NE times EMD sum together%part4 --Add noise to original data,we have X1for i=1:xsizetemp=randn(1,1)*Nstd; % add a random noise to YX1(i)=Y(i)+temp;end%part4 --assign original data in the first columnfor jj=1:1:xsizemode(jj,1) = Y(jj); % assign Y to column 1of modeend%part5--give initial 0to xorigin and xendxorigin = X1;   % xend = xorigin; %%part6--start to find an IMF-----IMF loop startnmode = 1;while nmode <= TNMxstart = xend; %last loop value assign to new iteration loop%xstart -loop start dataiter = 1;      %loop index initial value%part7--sift 10 times to get IMF---sift loop startwhile iter<=10 [spmax, spmin, flag]=extrema(xstart); %call function extrema%the usage of spline ,please see part11.upper= spline(spmax(:,1),spmax(:,2),dd); %upper spline bound of this siftlower= spline(spmin(:,1),spmin(:,2),dd); %lower spline bound of this siftmean_ul = (upper + lower)/2;            %spline mean of upper and lowerxstart = xstart - mean_ul;              %extract spline mean from Xstartiter = iter +1;end%part8--subtract IMF from data ,then let the residual xend to start to find next IMFxend = xend - xstart;      nmode=nmode+1;              %part9--after sift 10 times,that xstart is this time IMFfor jj=1:1:xsizemode(jj,nmode) = xstart(jj);  end
end%part10--after gotten all(TNM) IMFs ,the residual xend is over all trend
% put them in the last columnfor jj=1:1:xsizemode(jj,nmode+1)=xend(jj);end%after part 10 ,original + TNM IMFs+overall trend ---those are all in modeallmode=allmode+mode;   
end  %part3 Do EEMD -----EEMD loop end%part11--devide EEMD summation by NE,std be multiply back to data
allmode=allmode/NE;    
allmode=allmode*Ystd;  

结果展示

在这里插入图片描述

提示:这里对文章进行总结:
例如:以上就是今天要讲的内容,本文仅仅简单介绍了pandas的使用,而pandas提供了大量能使我们快速便捷地处理数据的函数和方法
在这里插入图片描述


http://www.ppmy.cn/news/428718.html

相关文章

主动降噪技术

当你每天乘坐交通工具的时候&#xff0c;是否注意到了周围环境的噪声污染&#xff1f;面对耳朵里跑进来恼人的噪音&#xff0c;除了堵住耳朵这种被动的方法&#xff0c;我们现在还可以主动出击&#xff0c;用声音将噪声消灭掉。 用一句话来概括主动降噪的原理&#xff1a;通过…

SSM框架搭建

SSM环境搭建 1 IDE的话&#xff0c;我用的MyEcplise&#xff0c;如果用Ecplise的话&#xff0c;需要自行配置服务器。 首先&#xff0c;建一个Dynamic工程&#xff0c;需要注意的是一定要勾选上web.xml。 将Spring框架包、jstl包、standard包、common-logging包、aopallian…

C#异步详解

异步编程是指在程序执行过程中&#xff0c;不需要等待某个操作完成&#xff0c;就可以继续执行后续的代码。比如我们开发了一个web页面中有一个上传文件功能&#xff0c;我们上传文件时使用异步操作&#xff0c;就不用等待文件的上传时间&#xff0c;可以先在网页上进行其他操作…

DecimalFormat基本用法

1.保留两位小数(截断&#xff09; 下面展示一些 内联代码片。 double num 11.256;DecimalFormat df new DecimalFormat("#.##");//指定RoundingModedf.setRoundingMode(RoundingMode.DOWN);String str df.format(num);double formatNum Double.parseDouble(str)…

宽带拨号连接显示被远程计算机终止

搜索框打开设备管理器 找到网络适配器 找到IP协议 卸载设备之后重启电脑

C++ STL中stack栈(简单讲解+例题运用)

运用stack函数首先需要头文件#include<stack>&#xff0c;栈是先进后出 stack的常用函数&#xff1a; push&#xff08;&#xff09;——向栈顶压入元素pop &#xff08;&#xff09;——弹出栈顶元素top &#xff08;&#xff09;——访问栈顶元素empty&#xff08…

账号被计算机远程终止,宽带远程连接被终止怎么办

宽带远程连接被终止?拨号上网的时候突然出现错误629,连接被远程计算机终止,这到底是怎么回事?面对连接宽带错误,下面让小编教你解决629被远程计算机终止的问题. 今天小编教你遇到宽带远程连接被终止&#xff0c;如何快速解决吧。 1.操作系统中存在错误&#xff0c;并提示您正…

台式电脑连接宽带远程计算机没反应怎么办,怎么处理宽带连接提示连接被远程计算机终止?...

现在有很多人使用宽带拨号上网&#xff0c;有个小伙伴的宽带有一天就出现了宽带被远程计算机终止&#xff0c;这是怎么一回事呢&#xff1f;这样一来他的宽带就无法上网了&#xff0c;电脑没了网基本什么也干不了。请大家和小编一起来看看这个问题有什么好办法可以解决呢&#…