Find function's minimum for specific constant values

2 ビュー (過去 30 日間)
Valeria
Valeria 2018 年 6 月 4 日
コメント済み: Walter Roberson 2018 年 6 月 5 日
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?

回答 (2 件)

Walter Roberson
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
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
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
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 件のコメント
Valeria
Valeria 2018 年 6 月 5 日
Matlab doesn't recognize its own function, although it is in its help file... Whattt
Walter Roberson
Walter Roberson 2018 年 6 月 5 日
Which function is not recognized?

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

カテゴリ

Help Center および File ExchangeNumbers and Precision についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by