👨🎓个人主页:研学社的博客
💥💥💞💞欢迎来到本博客❤️❤️💥💥
🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳️座右铭:行百里者,半于九十。
📋📋📋本文目录如下:🎁🎁🎁
目录
本文利用遗传算法 (GA) 实现,用于调整 PID 控制器的增益。 的重点是无人机(UAV)上使用的PID控制器。模拟二阶系统的动力学。调优基于满意度等标准。
部分代码:
clear all;
clc;
% Values of damping, natural frequency and SS gain
damping_ratio = (2:8)/10;
natural_freq = (3:10);
b0 = 1;
%variables used to selected different frequency/damping values
i = 1; % natural frequency
j = 1; % damping ratio
% Calculating the values of the nominator and denominator of the TF
a = b0*(natural_freq(i)^2);
b = 2*natural_freq(i)*damping_ratio(j);
c = natural_freq(i)^2;
k =1;
%Simulink model required
model = 'reference_tracking';
load_system(model)
max_prop_gain = 1;
max_int_gain = 1;
% kp_initial = rand*max_prop_gain;
% ki_initial = rand*max_int_gain;
kp_initial = 3;
ki_initial = 3;
%population creation
gains = [ kp_initial ki_initial;
0.5*kp_initial ki_initial;
kp_initial 0.5*ki_initial;
0.5*kp_initial 0.5*ki_initial
2*kp_initial 2*ki_initial];
disp(gains);
kp = kp_initial;
ki = ki_initial;
kp_p1 = num2str(kp);
ki_p2 = num2str(ki);
s_kp_p1 = strcat('Initial P Gain: ', kp_p1);
s_ki_p2 = strcat('Initial I Gain: ',ki_p2);
initial_gains = [s_kp_p1 char(10) s_ki_p2]; % textbox element
部分理论来源于网络,如有侵权请联系删除。
[1]杨黎明. 一种改进的免疫遗传算法及在PID控制器优化设计中的应用[D].中南大学,2007.