Clear Filters
Clear Filters

Find function's minimum for specific constant values

1 view (last 30 days)
I have a function mew which is a derivative of another function, fun:
syms v a b
fun = -a*v + (2*b*v^(2/3))/(exp(0.5) - 2*(v^(1/3))*log(exp(0.5)*v^(1/3)));
mew=diff(fun,v)
I must find mew's minimum for a=0, b=1.3
How?

Answers (2)

Walter Roberson
Walter Roberson on 4 Jun 2018
G = subs(mew, [a, b], [0, 1.3]);
sol = solve(G);
mewmin = subs(G, v, sol)
crosscheck = subs(G, v, sol+1)
The reason for doing the crosscheck is that solve() is only able to find a single numeric root, and without further checking you do not know whether it will be a maxima or a minima. The fact that the crosscheck comes out with a larger value (less negative) than the min gives evidence that we are indeed working with a minima not a maxima. But you should really look at sign( subs(diff(mew), v, sol ) to be sure.
  2 Comments
Walter Roberson
Walter Roberson on 4 Jun 2018
Note that if there are multiple minima then this will not find them all to check which is the global minimum.
Walter Roberson
Walter Roberson on 5 Jun 2018
MATLAB finds sol as
6396480385065521911547770910773962672562070583/(1427247692705959881058285969449495136382746624*lambertw(0, (3445831591435597800619981388529*exp(-1))/1267650600228229401496703205376)^3)
However, if you change the exp(0.5) to exp(sym(0.5)) then the more accurate solution is
exp(3/2)/LambertW(1)^3

Sign in to comment.


Sid Parida
Sid Parida on 4 Jun 2018
Try this:
You can play wit the lb, and ub to get the global minimum:
syms v a b
fun = -a*v + (2*b*v^(2/3))/(exp(0.5) - 2*(v^(1/3))*log(exp(0.5)*v^(1/3)));
mew = diff(fun,v);
subbed_ab = matlabFunction(subs(mew, {a, b}, {0.0, 1.3}));
lower_bound = -100000;
upper_bound = 100000;
min_val= fminbnd(subbed_ab, lower_bound, upper_bound);
  3 Comments
Valeria
Valeria on 5 Jun 2018
Matlab doesn't recognize its own function, although it is in its help file... Whattt

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!