how to write objective function for 4 variables
4 次查看(过去 30 天)
显示 更早的评论
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.
回答(1 个)
Walter Roberson
2012-7-8
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genetic Algorithm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!