Genetic Algorithm using ga command is giving solutions out of defined bounds.

2 ビュー (過去 30 日間)
SM
SM 2022 年 3 月 4 日
コメント済み: SM 2022 年 3 月 4 日
I am using ga command to find optimal values for a pd controller for a plant. I have defined the contraints an dthe lower and upper bounds, however each time it is giving me negative solutions for Kd(Second parameter of PD controller). Kindly help.
clear all, close all, clc
dt = 0.001;
PopSize = 25;
MaxGenerations = 10;
s = tf('s');
G = 1/ (s^2 + 2.813*s + 1.768);
lb=1;
ub=100;
options = optimoptions(@ga,'PopulationSize',PopSize,'MaxGenerations',MaxGenerations);
[x,fval] = ga(@(K)pidtest1(G,dt,K),2,-eye(2),zeros(2,1),[],[],lb,ub,[],options);

採用された回答

Matt J
Matt J 2022 年 3 月 4 日
[x,fval] = ga(@(K)pidtest1(G,dt,K),2,[],[],[],[],[1,1],[100,100],[],options);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGenetic Algorithm についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by