资源简介
主要用于机械振动故障的识别与诊断
代码片段和文件信息
% GSA code v1.0.
% Generated by Esmat Rashedi 2009.
% Adopted from: “ E. Rashedi H. Nezamabadi-pour and S. Saryazdi
% 揋SA: A Gravitational Search Algorithm? Information sciences vol. 179
% no. 13 pp. 2232-2248 2009.“
% Gravitational Search Algorithm.
function [FbestLbestBestChartMeanChart]=GSAcgRegression(F_indexNmax_itElitistChecktsxts)
%V: Velocity.
%a: Acceleration.
%M: Mass. Ma=Mp=Mi=M;
%dim: Dimension of test function.
%N: Number of agents.
%X: Position of agents. dim-by-N matrix.
%R: Distance between agents in search space.
%[low-up]: Allowable range for search space.
%Rnorm: Norm in eq.8.
%Rpower: Power of R in eq.7.
Rnorm=2;
Rpower=1;
min_flag=1; % 1: minimization 0: maximization
%get allowable range and dimension of the test function.
[lowupdim]=test_functions_range(F_index);
%random initialization for agents.
X=initialization(dimNuplow);
%create chart of best so far and average fitnesses.
BestChart=[];MeanChart=[];
V=zeros(dimN);
for iteration=1:max_it
% iteration
%Checking allowable range.
X=space_bound(Xuplow);
%Evaluation of agents.
fitness=evaluateSVM(XF_indextsxts);
[best best_X]=min(fitness); %min: minimization. max: maximization.
if iteration==1
Fbest=best;Lbest=X(:best_X);
end
if best : maximization
Fbest=best;Lbest=X(:best_X);
end
BestChart=[BestChart Fbest];
MeanChart=[MeanChart mean(fitness)];
%Calculation of M. eq.14-20
[M]=massCalculation(fitnessmin_flag);
%Calculation of Gravitational constant. eq.13.
G=Gconstant(iterationmax_it);
%Calculation of accelaration in gravitational field. eq.7-1021.
a=Gfield(MXGRnormRpowerElitistCheckiterationmax_it);
%Agent movement. eq.11-12
[XV]=move(XaV);
end %iteration
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1919 2012-07-14 07:09 GSAcgRegression.m
----------- --------- ---------- ----- ----
1919 1
评论
共有 条评论