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 commentaire

Roger Stafford
Roger Stafford le 20 Mar 2017
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.

Connectez-vous pour commenter.

Réponses (1)

Star Strider
Star Strider le 20 Mar 2017
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])

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by