%归一化 fuhe = fuhe'; Y = mapminmax(fuhe,0,1); fuhe = Y'; for u = 5:100 train_x = [fuhe(1:88,1:4)]; train_y = [fuhe(1:88,u)]; test_x = [fuhe(89,1:4)]; test_y = [fuhe(89,u)]; %% 利用灰狼算法选择最佳的SVR参数 SearchAgents_no=20; % 狼群数量 Max_iteration=200; % 最大迭代次数 dim=2; % 此例需要优化两个参数c和g lb=[0.01,0.01]; % 参数取值下界 ub=[100,100]; % 参数取值上界 Alpha_pos=zeros(1,dim); % 初始化Alpha狼的位置 Alpha_score=inf; % 初始化Alpha狼的目标函数值,change this to -inf for maximization problems Beta_pos=zeros(1,dim); % 初始化Beta狼的位置 Beta_score=inf; % 初始化Beta狼的目标函数值,change this to -inf for maximization problems Delta_pos=zeros(1,dim); % 初始化Delta狼的位置 Delta_score=inf; % 初始化Delta狼的目标函数值,change this to -inf for maximization problems Positions=initialization(SearchAgents_no,dim,ub,lb); Convergence_curve=zeros(1,Max_iteration); l=0; % 循环计数器 while lub; Flag4lb=Positions(i,:)Alpha_score && fitnessAlpha_score && fitness>Beta_score && fitness