Where is my mistake on ga command in SIMULINK?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I am trying to use "ga" in SIMULINK, but i cannot perform it correctly.
Error message: Function handle cannot be used here.
How can i solve this problem?
Thanks,
function [uk, xk] = fcn(beta, w_z, yaw_angle, lat_pos,A_aug, B_aug, C_aug, yaw_angle_ref, Y_ref, uk_old, xk_old)
coder.extrinsic('ga');
...
J = (transpose(Rs - (F * Xf + phi * delta_Uk))) * Q * (Rs -(F * Xf + phi * delta_Uk)) + (transpose(delta_Uk)) * R_bar * delta_Uk;
nvars = 4;
lb = [];
ub = [];
Aeq = [];
beq = [];
P1 = [eye(p,p) zeros(p,p*(4 - 1))];
A = [T1; -T1;...
T1; -T1;...
];
b = [delta_uk_max; -delta_uk_min;...
uk_max - uk_old; -uk_min + uk_old;...
];
delta_Uk = ga(@J,nvars,A,b,Aeq,beq,lb,ub);
0 件のコメント
回答 (1 件)
Walter Roberson
2021 年 10 月 4 日
J = (transpose(Rs - (F * Xf + phi * delta_Uk))) * Q * (Rs -(F * Xf + phi * delta_Uk)) + (transpose(delta_Uk)) * R_bar * delta_Uk;
That is not a function, it is a variable, probably a 2D array.
delta_Uk = ga(@J,nvars,A,b,Aeq,beq,lb,ub);
You are trying to take the handle to the 2D array J as if J were the name of a function.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Quadratic Programming and Cone Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!