Find function's minimum for specific constant values
조회 수: 1 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
답변 (2개)
Walter Roberson
2018년 6월 4일
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
Walter Roberson
2018년 6월 4일
Note that if there are multiple minima then this will not find them all to check which is the global minimum.
Walter Roberson
2018년 6월 5일
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
Sid Parida
2018년 6월 4일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!