how can i combine LQR with genetic algorithm
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
i face adifficulty in designing LQR by genetic algorithm of an inverted pendulum that have Xmax <= 1m and V=(-10 , 10)
function y=myga(x)
Q=[x(1) x(2) x(3) x(4);x(5) x(6) x(7) x(8);
x(9) x(10) x(11) x(12); x(13) x(14) x(15) x(16)];
R=x(17);
A=[0 1 0 0;0 -0.1818 2.6727 0;0 0 0 1;0 -0.4545 30.1818 0];
B=[0; 1.8182; 0; 4.5455];
k=lqr(A,B,Q,R);
sim('invpend','setparam','k');
sum=0;
for i=1:length(simout.time)
sum=sum+simout.signals.values(i,1)-1;
end
y=sum;
options=gaoptimset('PopInitRange',[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100]';
x=ga(@myga,17,[],[],[],[],[],[],[],optimset);
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Genetic Algorithm finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!