HELP 3 variable optimization use fmincon

9 views (last 30 days)
Ji Heon Baek
Ji Heon Baek on 8 Aug 2023
Answered: Alan Weiss on 8 Aug 2023
I want to input many wave frequency values as input values and optimize three variables (length, width, draft) of the formula. F(w)=NG (F(w) is an expression consisting of a variable angular velocity, and NG is a complex expression consisting of the length, width, and draft of a ship) Here, I want to optimize the length, width, and draft of a ship for each angular velocity, but how? can i do it

Answers (1)

Alan Weiss
Alan Weiss on 8 Aug 2023
The short answer is you put all your variables into one variable, and call a solver on the one variable objective function. For example, x(1) could represent length, x(2) could represent width, and x(3) could represent draft. You also seem to have another variable, x(4) is angular velocity, but I am not sure that you want to optimize over x(4) or if angular velocity is a parameter, in which case you would have this not as x(4) but as another variable, maybe w. In any case, write your constraints and objective function in terms of x, and then call fmincon to solve things. See https://www.mathworks.com/help/optim/ug/example-nonlinear-constrained-minimization.html and https://www.mathworks.com/help/optim/ug/writing-scalar-objective-functions.html for more directions, and see Passing Extra Parameters for how to pass extra parameters.
Alan Weiss
MATLAB mathematical toolbox documentation

Categories

Find more on Problem-Based Optimization Setup in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!