How can I use the Optimization Toolbox to optimize an objective function to a certain target value?

I can use the Optimization Toolbox functions (fminbnd, fmincon, fminsearch, fminunc, fseminf) to optimize an objective function to a minimum value. How can I instead optimize an objective function to a certain target value?

 採用された回答

There is no out-of-the-box support in the Optimization Toolbox for optimizing an objective function to a target value. Instead, please try to minimize the absolute difference between the objective function output and your target value. The code for this could look something like the following for the function "fminbnd":
% "target" is the value you want the objective function to target
% "objfun" is the objective function
target_fun = @(x) abs(objfun(x) - target)
optimized = fminbnd(target_fun, ...)
% optimized will be the optimized input value that produces the output value closest to "target"

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSystems of Nonlinear Equations についてさらに検索

製品

リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by