how to write objective function for 4 variables

4 visualizzazioni (ultimi 30 giorni)
MD NASAR
MD NASAR il 1 Lug 2012
Hi All i want to write a objective function for 4 variables and i want all 4 variables value in output, how to write it please help me.
Thank you.

Risposte (1)

Walter Roberson
Walter Roberson il 8 Lug 2012
function y = myObjective(x)
first_variable = x(1);
second_variable = x(2);
third_variable = x(3);
fourth_variable = x(4);
...
y = ....
end
Then any of the optimization functions will report the vector of four values that optimized the objective.

Community Treasure Hunt

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

Start Hunting!

Translated by