Involve fminbnd in optimoptions

3 ビュー (過去 30 日間)
Sudhir Kumar
Sudhir Kumar 2021 年 10 月 30 日
コメント済み: Sudhir Kumar 2021 年 10 月 31 日
I want to minimize a function f: which has a single variable θ. I want to minimize the function so I want to use the command "fminbnd". Although I want to see the iteration display through "optimoptions". If I write a chunk of code like this
fun = @(theta) optimum_theta(alpha,snr_db(isnrdb),t_min,t_max,m,theta);
options = optimoptions('fminbnd','Display','iter'); % show iterations
[x fval exitflag output] = fminbnd(fun,lower_bound,upper_bound,options);
Here the chunk of code I am not getting how to proceed

採用された回答

John D'Errico
John D'Errico 2021 年 10 月 30 日
編集済み: John D'Errico 2021 年 10 月 30 日
Note that fminbnd is not provided as part of the optimization toolbox. As well, fminbnd has been around a long time. So optimoptions does not support fminbnd. (I suppose there are good arguments as to why it should. But it apparently does not.)
Use optimset instead.
fun = @(x) (x-pi).^2; % not very creative
opts = optimset('fminbnd');
opts.Display = 'iter';
[x fval exitflag output] = fminbnd(fun,0,10,opts)
Func-count x f(x) Procedure 1 3.81966 0.459775 initial 2 6.18034 9.23398 golden 3 2.36068 0.609825 golden 4 3.14159 0 parabolic 5 3.14163 1.11423e-09 parabolic 6 3.14156 1.11423e-09 parabolic Optimization terminated: the current x satisfies the termination criteria using OPTIONS.TolX of 1.000000e-04
x = 3.1416
fval = 0
exitflag = 1
output = struct with fields:
iterations: 5 funcCount: 6 algorithm: 'golden section search, parabolic interpolation' message: 'Optimization terminated:↵ the current x satisfies the termination criteria using OPTIONS.TolX of 1.000000e-04 ↵'
Note: you would have learned that quickly had you read the docs for fminbnd, where you would see that it uses optimset.
  1 件のコメント
Sudhir Kumar
Sudhir Kumar 2021 年 10 月 31 日
Thank you so much @John D'Errico for your explanation.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOptimization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by