ga_ex343.m

来自「其中提到遺傳學的程式碼與應用提供給次淚相向的研究者參考下載」· M 代码 · 共 49 行

M
49
字号
% GA_ex343.m file
% Finding scaling factors Se Sde and dSu.

% PenChen Chou, 2-6-2002

%**********************************************************/
%       User can modify the following in blocks
%**********************************************************/
clear all
global MIN_offset MUL_factor K a1 a2 Ts Emin ERR Se Sde dSu

nn_flc=readfis('nn_flc');
%ex38_fis=readfis('ex38_fis');
Emin=5e4;
MIN_offset=Emin; % For finding MIN value
MUL_factor=1; 
Ts=0.01;
obj_fcn = 'GA_f343';	% Objective function
%          Se     Sde     dSu    
range = [  1       0.1    0.0001  
          20       10     0.01 ];
IC=[]; elite=1; 
gen_no=10;
popuSize=20;
bit_n=30;
xover_rate=0.9;
mutate_rate=0.03;
%************************************************************
% call GA 
tic
%GA_genetic(obj_fcn, range, IC, elite,...
% gen_no, popuSize, bit_n, xover_rate, mutate_rate);
[popu, popu_real, fcn_value, upper, average, lower, ...
BEST_popu, popuSize, gen_no, para] = GA_genetic(obj_fcn, range,...
        IC, elite, gen_no, popuSize, bit_n,...
        xover_rate, mutate_rate);
t=toc/60;
fprintf('==>  Computation time is (%.2f) minutes.\n',t);            
            
K=10;a1=3;a2=2;
Se=GA_round4dp(para(1));
Sde=GA_round4dp(para(2));
dSu=GA_round4dp(para(3));
[tout, X, Y]=sim('ex38s1',[0 140]); % see [tout and yout]
yout=Y(:,2); Err=Y(:,3); 
figure(2);plot(tout, [yout Y(:,1)]);
title('I/O responses, nominal plant parameters');
xlabel('Time(s)')

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?