How to find maximum of a function

Hello, i'm trying to find the maximum of a function without any given range. Max function is not working, how do I go about this? Here is my function, however I have no idea how to go about finding the max.
fx=@(x) ((0.4/((1+x^2)^(1/2)))-(((1+x^2)^(1/2))*(1-(0.4/1+x^2)))+x);
fplot(fx)

1 Comment

On the far right of the function you have "1-(0.4/1+x^2)". Since it is redundant to just divide by 1, I am wondering if you didn't mean this: "1-0.4/(1+x^2)" instead. You have a similar quantity, (except for the 1/2 power,) to the left of this.

Sign in to comment.

Answers (1)

Your function is an upward-facing parabola, so the maximum is +Inf. It has a minimum (inflection point) at about -0.562.
fx=@(x) ((0.4./((1+x.^2).^(1/2)))-(((1+x.^2).^(1/2)).*(1-(0.4/1+x.^2)))+x);
derv = @(f,x) (f(x+1E-8) - f(x)) / 1E-8;
infl_pt = fzero(@(x) derv(fx,x), 1E+5);
figure(1)
fplot(fx, [infl_pt-1E+3 infl_pt+1E+3])

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Asked:

on 20 Mar 2017

Commented:

on 20 Mar 2017

Community Treasure Hunt

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

Start Hunting!