HELP 3 variable optimization use fmincon

3 次查看(过去 30 天)
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

回答(1 个)

Alan Weiss
Alan Weiss 2023-8-8
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

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by