✅作者简介:热爱科研的Matlab仿真开发者,擅长毕业设计辅导、数学建模、数据处理、建模仿真、程序设计、完整代码获取、论文复现及科研仿真。
🍎 往期回顾关注个人主页:Matlab科研工作室
👇 关注我领取海量matlab电子书和数学建模资料
🍊个人信条:格物致知,完整Matlab代码获取及仿真咨询内容私信。
🔥 内容介绍
一、引言
在信号处理领域,去除噪声对于获取准确有效的信息至关重要。完备总体经验模态分解自适应噪声(ICEEMDAN)是一种强大的信号分解方法,然而其分解过程可能存在模态混叠等问题。开普勒优化算法(KOA)是一种新兴的元启发式优化算法,受开普勒定律启发,具有良好的全局搜索能力。将 KOA 应用于 ICEEMDAN,可优化其分解参数,实现更高效的信号去噪。
二、相关理论基础
(一)完备总体经验模态分解自适应噪声(ICEEMDAN)
基本原理:ICEEMDAN 是对总体经验模态分解(EEMD)的改进。EEMD 通过多次添加不同的白噪声并进行经验模态分解(EMD),然后对结果进行平均来抑制模态混叠。ICEEMDAN 在此基础上,通过自适应地添加特定的噪声,进一步提高了分解的准确性和稳定性。它将原始信号x(t)逐步分解为一系列固有模态函数(IMF)ci(t)和一个残余项r(t),即x(t)=∑i=1nci(t)+r(t)。每个 IMF 满足两个条件:一是在整个数据长度内,极值点的数量与过零点的数量必须相等或最多相差一个;二是在任意点,由局部极大值点形成的上包络线和由局部极小值点形成的下包络线的均值为零。
优势与不足:ICEEMDAN 的优势在于能够自适应地分解非平稳、非线性信号,对复杂信号具有良好的分解能力。但在实际应用中,仍可能出现模态混叠现象,即一个 IMF 中包含了不同尺度的信号成分,或者不同 IMF 之间存在相似尺度的成分,这会影响后续对信号的分析和处理。
(二)开普勒优化算法(KOA)
算法灵感与原理:KOA 模拟了天体在太阳系中的运动,依据开普勒定律进行搜索。在 KOA 中,每个解被视为一个天体,其位置和速度分别对应解的参数和搜索方向。通过更新天体的位置和速度,算法在解空间中进行搜索。例如,根据开普勒第二定律,天体在相等时间内扫过相等的面积,这在算法中转化为一种自适应的搜索策略,使得算法在搜索初期能够快速探索解空间,后期则更注重局部搜索以提高解的精度。
算法流程:
初始化:随机生成一组天体(初始解),并确定每个天体的初始位置和速度。
更新位置和速度:根据开普勒定律,通过迭代更新天体的速度和位置。速度更新公式结合了引力和斥力的作用,位置更新则基于速度的变化。
适应度评估:计算每个天体(解)的适应度值,以评估解的优劣。适应度函数通常根据具体问题进行设计,在信号去噪问题中,可以是去噪后信号与原始纯净信号的误差度量。
选择与更新:根据适应度值选择较优的天体,并更新种群。重复上述步骤,直到满足终止条件(如达到最大迭代次数或适应度值收敛)。
三、基于 KOA - ICEEMDAN 的信号去噪方法
(一)参数优化思路
ICEEMDAN 在分解信号时,一些参数(如添加噪声的强度、分解层数等)对分解结果有重要影响。使用 KOA 对这些参数进行优化,以找到最优的参数组合,从而减少模态混叠,提高去噪效果。具体来说,将 ICEEMDAN 的参数空间作为 KOA 的搜索空间,通过 KOA 的迭代搜索,找到使去噪后信号质量最优的参数值。
(二)KOA - ICEEMDAN 算法步骤
初始化 KOA 参数:设置 KOA 的种群规模、最大迭代次数、引力常数等参数。同时,确定 ICEEMDAN 待优化的参数范围,如噪声强度的取值范围、最大分解层数等。
生成初始种群:在 ICEEMDAN 参数空间内,随机生成一组参数组合作为 KOA 的初始种群,每个参数组合代表一个天体的初始位置。
适应度计算:对于种群中的每个参数组合,将其应用于 ICEEMDAN 对含噪信号进行分解。然后,计算去噪后信号的适应度值。适应度函数可以定义为去噪后信号与原始纯净信号的均方误差(MSE)的倒数,即Fitness=MSE1,MSE 越小,适应度值越大,表示去噪效果越好。
KOA 迭代优化:按照 KOA 的算法流程,更新天体的速度和位置,即调整 ICEEMDAN 的参数组合。每次迭代后,重新计算适应度值,并根据适应度值选择较优的参数组合。
确定最优参数与去噪:当 KOA 满足终止条件时,得到最优的 ICEEMDAN 参数组合。使用该参数组合对含噪信号进行 ICEEMDAN 分解,得到一系列 IMF。通过对 IMF 进行筛选和重构,去除噪声相关的 IMF,重构得到去噪后的信号。
⛳️ 运行结果
📣 部分代码
%开普勒优化算法function [Sun_Score,Sun_Pos,Convergence_curve]=KOA(SearchAgents_no,Tmax,lb,ub,dim,feval)%%%%-------------------Definitions--------------------------%%%%Sun_Pos=zeros(1,dim); % A vector to include the best-so-far Solution, representing the SunSun_Score=inf; % A Scalar variable to include the best-so-far scoreConvergence_curve=zeros(1,Tmax);if length(lb)==1lb = lb*ones(1,dim);ub = ub*ones(1,dim);end%%-------------------Controlling parameters--------------------------%%%%Tc=3;M0=0.1;lambda=15;%% Step 1: Initialization process%%---------------Initialization----------------------%%% Orbital Eccentricity (e)orbital=rand(1,SearchAgents_no); %% Eq.(4)%% Orbital Period (T)T=abs(randn(1,SearchAgents_no)); %% Eq.(5)Positions=initialization(SearchAgents_no,dim,ub,lb); % Initialize the positions of planetst=0; %% Function evaluation counter%%%%---------------------Evaluation-----------------------%%for i=1:SearchAgents_no%% Test suites of CEC-2014, CEC-2017, CEC-2020, and CEC-2022PL_Fit(i)=feval( Positions(i,:));% Update the best-so-far solutionif PL_Fit(i)<Sun_Score % Change this to > for maximization problemSun_Score=PL_Fit(i); % Update the best-so-far scoreSun_Pos=Positions(i,:); % Update te best-so-far solutionendendwhile t<Tmax %% Termination condition[Order] = sort(PL_Fit); % Sorting the fitness values of the solutions in current population%% The worst Fitness value at function evaluation tworstFitness = Order(SearchAgents_no); %% Eq.(11)M=M0*(exp(-lambda*(t/Tmax))); %% Eq. (12)%% Computer R that represents the Euclidian distance between the best-so-far solution and the ith solutionfor i=1:SearchAgents_noR(i)=0;for j=1:dimR(i)=R(i)+(Sun_Pos(j)-Positions(i,j))^2; %% Eq.(7)endR(i)=sqrt(R(i));end%% The mass of the Sun and object i at time t is computed as follows:for i=1:SearchAgents_nosum=0;for k=1:SearchAgents_nosum=sum+(PL_Fit(k)-worstFitness);endMS(i)=rand*(Sun_Score-worstFitness)/(sum); %% Eq.(8)m(i)=(PL_Fit(i)-worstFitness)/(sum); %% Eq.(9)end%% Step 2: Defining the gravitational force (F)% Computing the attraction force of the Sun and the ith planet according to the universal law of gravitation:for i=1:SearchAgents_noRnorm(i)=(R(i)-min(R))/(max(R)-min(R)); %% The normalized R (Eq.(24))MSnorm(i)=(MS(i)-min(MS))/(max(MS)-min(MS)); %% The normalized MSMnorm(i)=(m(i)-min(m))/(max(m)-min(m)); %% The normalized mFg(i)=orbital(i)*M*((MSnorm(i)*Mnorm(i))/(Rnorm(i)*Rnorm(i)+eps))+(rand); %% Eq.(6)end%% a1 represents the semimajor axis of the elliptical orbit of object i at time t,for i=1:SearchAgents_noa1(i)=rand*(T(i)^2*(M*(MS(i)+m(i))/(4*pi*pi)))^(1/3); %% Eq.(23)endfor i=1:SearchAgents_no%% a2 is a cyclic controlling parameter that is decreasing gradually from -1 to ?2a2=-1+-1*(rem(t,Tmax/Tc)/(Tmax/Tc)); %% Eq.(29)%% ? is a linearly decreasing factor from 1 to ?2n=(a2-1)*rand+1; %% Eq.(28)a=randi(SearchAgents_no); %% An index of a solution selected at randomb=randi(SearchAgents_no); %% An index of a solution selected at randomrd=rand(1,dim); %% A vector generated according to the normal distributionr=rand; %% r1 is a random number in [0,1]%% A randomly-assigned binary vectorU1=rd<r; %% Eq.(21)O_P=Positions(i,:); %% Storing the current position of the ith solution%% Step 6: Updating distance with the Sunif rand<rand%% h is an adaptive factor for controlling the distance between the Sun and the current planet at time th=(1/(exp(n.*randn))); %% Eq.(27)%% An verage vector based on three solutions: the Current solution, best-so-far solution, and randomly-selected solutionXm=(Positions(b,:)+Sun_Pos+Positions(i,:))/3.0;Positions(i,:)=Positions(i,:).*U1+(Xm+h.*(Xm-Positions(a,:))).*(1-U1); %% Eq.(26)else%% Step 3: Calculating an object? velocity% A flag to opposite or leave the search direction of the current planetif rand<0.5 %% Eq.(18)f=1;elsef=-1;endL=(M*(MS(i)+m(i))*abs((2/(R(i)+eps))-(1/(a1(i)+eps))))^(0.5); %% Eq.(15)U=rd>rand(1,dim); %% A binary vectorif Rnorm(i)<0.5 %% Eq.(13)M=(rand.*(1-r)+r); %% Eq.(16)l=L*M*U; %% Eq.(14)Mv=(rand*(1-rd)+rd); %% Eq.(20)l1=L.*Mv.*(1-U);%% Eq.(19)V(i,:)=l.*(2*rand*Positions(i,:)-Positions(a,:))+l1.*(Positions(b,:)-Positions(a,:))+(1-Rnorm(i))*f*U1.*rand(1,dim).*(ub-lb); %% Eq.(13a)elseU2=rand>rand; %% Eq. (22)V(i,:)=rand.*L.*(Positions(a,:)-Positions(i,:))+(1-Rnorm(i))*f*U2*rand(1,dim).*(rand*ub-lb); %% Eq.(13b)end %% End IF%% Step 4: Escaping from the local optimum% Update the flag f to opposite or leave the search direction of the current planetif rand<0.5 %% Eq.(18)f=1;elsef=-1;end%% Step 5Positions(i,:)=((Positions(i,:)+V(i,:).*f)+(Fg(i)+abs(randn))*U.*(Sun_Pos-Positions(i,:))); %% Eq.(25)end %% End If%% Return the search agents that exceed the search space's boundsif rand<randfor j=1:size(Positions,2)if Positions(i,j)>ub(j)Positions(i,j)=lb(j)+rand*(ub(j)-lb(j));elseif Positions(i,j)<lb(j)Positions(i,j)=lb(j)+rand*(ub(j)-lb(j));end %% End Ifend %% End ForelsePositions(i,:) = min(max(Positions(i,:),lb),ub);end %% End If%% Test suites of CEC-2014, CEC-2017, CEC-2020, and CEC-2022% Calculate objective function for each search agentPL_Fit1=feval(Positions(i,:));% Step 7: Elitism, Eq.(30)if PL_Fit1<PL_Fit(i) % Change this to > for maximization problemPL_Fit(i)=PL_Fit1; %% Update the best-so-far solutionif PL_Fit(i)<Sun_Score % Change this to > for maximization problemSun_Score=PL_Fit(i); % Update the best-so-far scoreSun_Pos=Positions(i,:); % Update te best-so-far solutionendelsePositions(i,:)=O_P;end %% End IFt=t+1; %% Increment the current function evaluationif t>Tmax %% Checking the termination conditionbreak;end %% End IFConvergence_curve(t)=Sun_Score; %% Set the best-so-far fitness value at function evaluation t in the convergence curveend %% End for iend %% End whileConvergence_curve(t-1)=Sun_Score;end%% End Function