how to find max vaule of function handle?
10 views (last 30 days)
Show older comments
f=@(u) (u^2/(1+u^2))*(2/(u^2+0.55))-u
1 Comment
Walter Roberson
on 1 Jan 2019
The maximum is an irrational number involving one of the roots of a degree 8 polynomial.
Answers (1)
John D'Errico
on 1 Jan 2019
help fminbnd
help fminsearch
Now, you might be confused, as those are minimization tools. But suppose you multiplied your function by -1? Would the location now of a minimum be in the same location as the maximum you really want?
Do you know how to create a new function that is the same as another, but just negated? What if you did this?
fneg = @(u) -f(u);
2 Comments
John D'Errico
on 2 Jan 2019
Note that this function only has a local maximum. In fact, a global maximum does not exist.
syms u
F = (u^2/(1+u^2))*(2/(u^2+0.55))-u;
ezplot(F,[-5,5])

You can easily show the function itself is asymptotically linear as u approaches +inf or -inf. In order to find that local max, you will need to be careful in your choice of starting values. Or, you can use the symbolic toolbox, though you cannot find an analytical form for that local max.
Walter Roberson
on 2 Jan 2019
The analytical location of the local max is
root(z^8 + (31*z^6)/10 + 4*z^5 + (1401*z^4)/400 + (341*z^2)/200 - (11*z)/5 + 121/400, z, 2)
but there is no algebraic formula for that
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!