How to optimize a function below a given value?

1 回表示 (過去 30 日間)
David Boelke
David Boelke 2022 年 10 月 27 日
編集済み: Torsten 2022 年 10 月 27 日
I have a function, which gives an output based on some input. The function is super non linear, it calls a simulink model, integrates an maximizes along vectors, all kinds of things, but it returns a singular output, which I call the error.
I want to find an input, where the error is small, however I don't need to find the total minimum, I am happy if the error is smaller than, let's say 5.
The function fminsearch seemed promising to achieve this, and it works great, but it never really finishes. It keeps improving and improving. I can abort the optimization and use the parameters it has found so far, but I need to abort automatically. I have not found an option, which allows me to set value, that is sufficiently low. Is there a way to use fminsearch? Is there a better way?

回答 (1 件)

Torsten
Torsten 2022 年 10 月 27 日
編集済み: Torsten 2022 年 10 月 27 日
Use OutputFcn to stop the optimizer manually:

カテゴリ

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