How to use a function within optiproblem?

1 view (last 30 days)
Anthony Sirico
Anthony Sirico on 1 Dec 2021
Commented: Matt J on 1 Dec 2021
My minimization function is:
pi = x(1)+x(2)-rho*min(0,x(1)^2+x(2)^2
how can i use this equation in optimproblem?
prob = optimproblem("Objective",x(1)+x(2)-rho*min(0,x(1)^2+x(2)^2),"ObjectiveSense","minimize");
x0.x = [0;0];
Error using min
Invalid data type. Second argument must be numeric or logical.
  1 Comment
Matt J
Matt J on 1 Dec 2021
Note that min(0,x(1)^2+x(2)^2) will always be 0, so it is not contributing anything to the objective function.

Sign in to comment.

Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!