⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ga_ex641.m

📁 其中提到遺傳學的程式碼與應用提供給次淚相向的研究者參考下載
💻 M
字号:
% GA_ex641.m file
% Find scaling factors of a Fuzzy control system by using GA

% PenChen Chou, 8-5-2001

%**********************************************************/
%       User can modify the following in blocks
%**********************************************************/
clear all
ans=1;
who
fprintf('>>>Start this program now. Please wait!\n');
pause(1)

global MIN_offset MUL_factor LOCUS x_data y_data 
global Emin MDL Se Sde Su FT

MDL='dp22a_nc'; eval(MDL); FT=30; 
MIN_offset=9e4; LOCUS=0; x_data=[]; y_data=[];
MUL_factor=5;
Emin=MIN_offset;
obj_fcn = 'GA_f641';	% Objective function
range = [  0.01     0.0001      100
           10        0.05    2000];
IC=[];elite=1;
gen_no=35; popuSize=30; 
gen_no= 5; popuSize=20; 
bit_n=40; xover_rate=0.8; mutate_rate=0.05;
%************************************************************
% calling GA 
tic
% function [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);
[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);            
            
% Show the result using parameters found by GA
Se=para(1);
Sde=para(2);
Su=para(3);
[t, X, Y]=sim(MDL,[0:0.01:30]);
in=Y(:,2); x1=Y(:,3); u=Y(:,4); y=[in x1];
figure(2);subplot(211);plot(t,y);
title('GA based vehicle speed command and output responses(m/s.)');
xlabel(['Time(s), Se=' num2str(Se) ',Sde=' num2str(Sde) ',Su=' num2str(Su)]);
figure(2);subplot(212);plot(t,[u]);
title('Control effort');

⌨️ 快捷键说明

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