当前位置:网站首页>MATLAB 的ICEEMDAN分解代码实现
MATLAB 的ICEEMDAN分解代码实现
2022-08-04 05:34:00 【机器猫001】
0、前言
本文讲解ICEEMDAN分解方法,并分享代码。
1、ICEEMDAN实现
下面为主函数部分:
ecg=data;%data为待分解的一个信号数据,请替换为自己数据就行
%% 参数设置
Nstd = 0.2;
NR = 1;
MaxIter = 5000;
%% ICEEMDAN
[modes]=iceemdan(ecg,Nstd,NR,MaxIter,1);%iceemdan
modes=modes';
t=1:length(ecg);
[a b]=size(modes);
figure;
subplot(a+1,1,1);
plot(t,ecg);% the ECG signal is in the first row of the subplot
ylabel('original')
set(gca,'xtick',[])
title('ICEEMDAN')
axis tight;
for i=2:a
subplot(a+1,1,i);
plot(t,modes(i-1,:));
ylabel (['IMF ' num2str(i-1)]);
set(gca,'xtick',[])
xlim([1 length(ecg)])
end
subplot(a+1,1,a+1)
plot(t,modes(a,:))
ylabel(['IMF ' num2str(a)])
xlim([1 length(ecg)])
xlabel('样本点')
子函数iceemdan的代码:
function [modes]=iceemdan(x,Nstd,NR,MaxIter,SNRFlag)
% The current is an improved version, introduced in:
%[1] Colominas MA, Schlotthauer G, Torres ME. "Improve complete ensemble EMD: A suitable tool for biomedical signal processing"
% Biomedical Signal Processing and Control vol. 14 pp. 19-29 (2014)
%The CEEMDAN algorithm was first introduced at ICASSP 2011, Prague, Czech Republic
%The authors will be thankful if the users of this code reference the work
%where the algorithm was first presented:
%[2] Torres ME, Colominas MA, Schlotthauer G, Flandrin P. "A Complete Ensemble Empirical Mode Decomposition with Adaptive Noise"
% Proc. 36th Int. Conf. on Acoustics, Speech and Signa Processing ICASSP 2011 (May 22-27, Prague, Czech Republic)
%Author: Marcelo A. Colominas
%contact: [email protected]
%Last version: 25 feb 2015
desvio_x=std(x);
x=x/desvio_x;
[a,b]=size(x);
temp=zeros(b,1);
modes=zeros(b,1);
aux=zeros(a,b);
for i=1:NR
white_noise{i}=randn(size(x));%creates the noise realizations
end;
for i=1:NR
modes_white_noise{i}=emd(white_noise{i},'display',0);%calculates the modes of white gaussian noise
end;
% save interval modes_white_noise
for i=1:NR %calculates the first mode
xi=x+Nstd*modes_white_noise{i}(:,1)'/std(modes_white_noise{i}(:,1));
[temp, o, it]=emd(xi,'MaxNumIMF',1,'SiftMaxIterations',MaxIter,'display',0);
aux=aux+(xi-temp')/NR;% nnnnnnnnnnnnnnnnJub局部包络
end;
modes= (x-aux)'; %saves the first mode
medias = aux; % r1
k=1;
aux=zeros(a,b);
es_imf = min(size(emd(medias(1,:),'SiftMaxIterations',MaxIter,'display',0)));
while es_imf>1 %calculates the rest of the modes
for i=1:NR
tamanio=size(modes_white_noise{i});
if tamanio(2)>=k+1
noise=modes_white_noise{i}(:,k+1);
if SNRFlag == 2
noise=noise/std(noise); %adjust the std of the noise
end;
noise=Nstd*noise;
try
[temp,o,it]=emd(medias(1,:)+std(medias(1,:))*noise','MaxNumIMF',1,'SiftMaxIterations',MaxIter,'display',0);
catch
temp=emd(medias(1,:)+std(medias(1,:))*noise','MaxNumIMF',1,'SiftMaxIterations',MaxIter,'display',0);
end;
else
try
[temp, o, it]=emd(medias(1,:),'MaxNumIMF',1,'SiftMaxIterations',MaxIter,'display',0);
catch
temp=emd(medias(1,:),'MaxNumIMF',1,'SiftMaxIterations',MaxIter,'display',0);
end;
end;
aux=aux+(medias(1,:)+std(medias(1,:))*noise'-temp')/NR;% r2 r3 r...
end;
modes=[modes (medias(1,:)-aux)'];
medias = aux;
aux=zeros(size(x));
k=k+1;
es_imf = min(size(emd(medias(1,:),'SiftMaxIterations',MaxIter,'display',0)));
end;
modes = [modes (medias(1,:))'];
modes=modes*desvio_x;
上述代码可以直接运行,实现信号分解。
边栏推荐
猜你喜欢
随机推荐
Jackson 使用样例
有且仅有的三种处理JSON的方法
普通用户 远程桌面连接 服务器 Remote Desktop Service
罗斯50分
读取JDBC配置文件
MySQL stored procedure study notes (based on 8.0)
沉浸式体验参加网络安全培训班,学习过程详细到底!
Memory Management
杰哥带大家做一次meterpreter内网渗透模拟
Uos统信系统 本地APT源配置
YOLOv3详解:从零开始搭建YOLOv3网络
FCN——语义分割的开山鼻祖(基于tf-Kersa复现代码)
2022在 Go (Golang) 中使用微服务的系统课程
JUC并发容器——阻塞队列
vs2017 redist 下载地址
键盘扫描码
SegNet——论文笔记
EfficientNet解读:神经网络的复合缩放方法(基于tf-Kersa复现代码)
JUC锁框架——基于AQS的实现,从ReentrantLock认识独占和共享
狗都能看懂的CenterNet讲解及代码复现