| 查看: 1231 | 回复: 0 | ||
bingbz金虫 (小有名气)
|
[求助]
基于遗传算法的LQR优化问题,适应度函数总是报错。
|
|
适应度函数如下: function scores=jisuan(pop) A=[0 0 1 0;0 0 0 1;0 -409.24 -81.06 104.63;0 269.35 54.58 -54.58]; B=[0 0;0 0;101.7 101.7;-53.05 -53.05]; C=eye(4); D=[0 0;0 0;0 0;0 0]; Q=[pop(1) 0 0 0; 0 pop(2) 0 0;0 0 pop(3) 0;0 0 0 pop(4)]; R=[1 0;0 1]; Bc=B; Cc=C; Dc=D; [K,S,E]=lqr(A,B,Q,R); Ac=(A-B*K); T=0:0.005:15; U=0*ones(3001,2); x0=[0;0;0.3;0]; [y,x]=lsim(Ac,Bc,Cc,Dc,U,T,x0); u=-1*(K*x'); scores=1-1/(pop(1)*(x(:,1)'*x(:,1))+pop(2)*(x(:,2)'*x(:,2))+pop(3)*(x(:,3)'*x(:,3))+pop(4)*(x(:,4)'*x(:,4))); end 总是报错: Error running optimization. The "lqr" command failed to stabilize the plant or find an optimal feedback gain. To remedy this problem: 1. Make sure that all unstable poles of A are controllable through B (use MINREAL to check) 2. Modify the weights Q and R to make [Q N;N' R] positive definite (use EIG to check positivity). 求大神帮助!! |
» 猜你喜欢
288求调剂,一志愿华南理工大学071005
已经有5人回复
一志愿中国海洋大学,生物学,301分,求调剂
已经有5人回复
294求调剂材料与化工专硕
已经有12人回复
0856调剂,是学校就去
已经有5人回复
0817 化学工程 299分求调剂 有科研经历 有二区文章
已经有13人回复
梁成伟老师课题组欢迎你的加入
已经有11人回复
复试调剂
已经有6人回复
0703化学调剂 ,六级已过,有科研经历
已经有11人回复
321求调剂
已经有10人回复
东华理工大学化材专业26届硕士博士申请
已经有8人回复













回复此楼