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
Roger Stafford
2017년 3월 20일
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.
답변 (1개)
Star Strider
2017년 3월 20일
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])
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!