Filter löschen
Filter löschen

Find function's minimum for specific constant values

1 Ansicht (letzte 30 Tage)
Valeria
Valeria am 4 Jun. 2018
Kommentiert: Walter Roberson am 5 Jun. 2018
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?

Antworten (2)

Walter Roberson
Walter Roberson am 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 Kommentare
Walter Roberson
Walter Roberson am 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 am 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

Melden Sie sich an, um zu kommentieren.


Sid Parida
Sid Parida am 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 Kommentare
Valeria
Valeria am 5 Jun. 2018
Matlab doesn't recognize its own function, although it is in its help file... Whattt
Walter Roberson
Walter Roberson am 5 Jun. 2018
Which function is not recognized?

Melden Sie sich an, um zu kommentieren.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by