function minimum evaluation problem

I have a function which is f(r) = (2^(r/w)-1)*a+b+(c/r), where a, b, c are constants and r is lower bounded by 20000.
I have evaluated using fmincon and also by using fzero and fsolve for f'(r) (differentiation of f(r)). The code is given below.
w = 20000;
No = .000001;%
% No = 10^(-20);
myu = 1000;
% rho = .1;
rho = .50;
btr = 5;
mean_bt = 1/btr;
tou = 0;
a = No*myu/rho;
%direct minimum
opt = optimoptions('fmincon', 'Algorithm', 'interior-point');
[x,fval,exitflag] = fmincon(@(r) (2^(r/w)-1)*a+mean_bt+(myu/r), 20000,[],[],[],[],20000,Inf, [], opt)
fsOpts = optimoptions('fsolve', 'MaxFunEvals', 1000, 'TolFun', 10^-9)
[r, fval, exitflag] = fsolve(@(r) (2^(r/w)*(a/w)*log(2))-(myu/r^2), 20000, fsOpts)
[optp,fval, exitflag] = fzero(@(r) (2^(r/w)*(a/w)*log(2))-(myu/r^2), 20000)
I am getting different values with different solvers. 1. With fmincon, I got 3.1969e+04, but it is observed that with 3.2100e+04, I am getting even lower value. I thought probably local minimum could be a reason, but it is not clear. 2. with fsolve, whatever inital value, I am getting the same value? 3. With fzero, I am getting 5.0267e+04 and it seems to be correct.
Could someone kindly explain me the possible reasons for the above behavior and correct ways to use solvers properly?

Antworten (0)

Diese Frage ist geschlossen.

Gefragt:

Sri
am 30 Sep. 2014

Geschlossen:

am 20 Aug. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by