Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Minimize an objective function
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi, I will like to ask for the objective function is there any other way to write instead of typing all the variables (X11 to X14) into the function. - f([X11 X12 X13 X14])
variables = {'X11','X12','X13','X14'};
N = length(variables);
display (N);
% create variables for indexing
for v = 1:N
eval([variables{v},' = ', num2str(v),';']);
end
% objective function
f = zeros(size(variables));
f([X11 X12 X13 X14 ])=[0.08,0.12,0.16,0.20];
Thanks
2 comentarios
Walter Roberson
el 4 de Ag. de 2017
I am at a loss as to what your intended result is. If X11 X12 X13 X14 are not positive integers, then f([X11 X12 X13 X14 ])=[0.08,0.12,0.16,0.20] would be trying to index the array f at non-integer locations.
I do not see where "objective function" comes into this?
Respuestas (0)
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!