fmincon with function file

2 ビュー (過去 30 日間)
Gautam Sethi
Gautam Sethi 2019 年 5 月 6 日
回答済み: Stephan 2019 年 5 月 6 日
Hi, I've written a function file that accepts values of variables x and y and parameter p. It outputs a scalar variable called sick.
I would like to minimize the value of sick by optimizing over x and y, each of which is bounded between 0 and 1.
It seems to me that fmincon would be appropriate funtion to do this. Could someome help me with the syntax that allows me to pass the function to the optimizer as well as the lower and upper bounds? I'd really appreciate it!

回答 (1 件)

Stephan
Stephan 2019 年 5 月 6 日
change your function, that it accepts x and p as input. use:
x = x(1);
y = x(2);
for passing p to the function read here:

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by