how to perform a multi variable optimization on matlab

20 次查看(过去 30 天)
i have a two variable cost function to minimize,is there specefic type of optimization to do it , i am trying some metaheuristics and when introducing the second variable it shows "not enough input variables" any recommendations please ? thank you
  4 个评论
Anwar
Anwar 2024-2-19
for the algorithm used ive tried many metaheuristics and only worked with one variable ,is there a way to make any algorithm work with two variables or there are specefic algorithms for the task
Walter Roberson
Walter Roberson 2024-2-19
%example
nvars = 23;
fun = @(xSv) costfunction(xSv(1:10), xSv(11:nvars));
[bestxSv, fval] = ga(fun, nvars);

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2024-2-19
There are several different minimizers possible. Everything except fzero() -- fzero() is restricted to one variable.
fun = @(XYZ) YourFunction(XYZ(1), XYZ(2), XYZ(3))

类别

Help CenterFile Exchange 中查找有关 Particle Swarm 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by