Where is my mistake on ga command in SIMULINK?

1 visualización (últimos 30 días)
Volkan Yangin
Volkan Yangin el 4 de Oct. de 2021
Respondida: Walter Roberson el 4 de Oct. de 2021
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);

Respuestas (1)

Walter Roberson
Walter Roberson el 4 de Oct. de 2021
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.

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by