This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Find Asymptotes, Critical and Inflection Points

This section describes how to analyze a simple function to find its asymptotes, maximum, minimum, and inflection point. The section covers the following topics:

Define a Function

The function in this example is


To create the function, enter the following commands:

syms x
num = 3*x^2 + 6*x -1;
denom = x^2 + x - 3;
f = num/denom
f = 
(3*x^2 + 6*x - 1)/(x^2 + x - 3)

Plot the function f by using fplot. The fplot function automatically shows horizontal asymptotes. Prior to R2016a, use ezplot instead of fplot.


Find Asymptotes

To mathematically find the horizontal asymptote of f, take the limit of f as x approaches positive infinity:

limit(f, inf)
ans = 

The limit as x approaches negative infinity is also 3. This result means the line y = 3 is a horizontal asymptote to f.

To find the vertical asymptotes of f, set the denominator equal to 0 and solve by entering the following command:

roots = solve(denom)

This returns the solutions to x2+x3=0:

roots =
 - 13^(1/2)/2 - 1/2
   13^(1/2)/2 - 1/2

This tells you that vertical asymptotes are the lines




Find Maximum and Minimum

You can see from the graph that f has a local maximum between the points x = –2 and x = 0, and might have a local minimum between x = –6 and x = –2. To find the x-coordinates of the maximum and minimum, first take the derivative of f:

f1 = diff(f)
f1 = 
(6*x + 6)/(x^2 + x - 3) - ((2*x + 1)*(3*x^2 + 6*x - 1))/(x^2 + x - 3)^2

To simplify this expression, enter

f1 = simplify(f1)
f1 =
 -(3*x^2 + 16*x + 17)/(x^2 + x - 3)^2

You can display f1 in a more readable form by entering


which returns

    3 x  + 16 x + 17 
  - ---------------- 
       2         2 
     (x  + x - 3)

Next, set the derivative equal to 0 and solve for the critical points:

crit_pts = solve(f1)
crit_pts =
 - 13^(1/2)/3 - 8/3
   13^(1/2)/3 - 8/3

It is clear from the graph of f that it has a local minimum at


and a local maximum at



MATLAB® does not always return the roots to an equation in the same order.

You can plot the maximum and minimum of f with the following commands:

hold on
plot(double(crit_pts), double(subs(f,crit_pts)),'ro')
title('Maximum and Minimum of f')
text(-4.8,5.5,'Local minimum')
text(-2,4,'Local maximum')
hold off

Find Inflection Point

To find the inflection point of f, set the second derivative equal to 0 and solve.

f2 = diff(f1);
inflec_pt = solve(f2,'MaxDegree',3);

This returns

ans =
  -5.2635 + 0.0000i
  -1.3682 - 0.8511i
  -1.3682 + 0.8511i

In this example, only the first entry is a real number, so this is the only inflection point. (Note that in other examples, the real solutions might not be the first entries of the answer.) Since you are only interested in the real solutions, you can discard the last two entries, which are complex numbers.

inflec_pt = inflec_pt(1);

To see the symbolic expression for the inflection point, enter

   2/3   1/3                  1/3    2/3   1/3                  1/3
  2    13    (13 - 3 sqrt(13))      2    13    (3 sqrt(13) + 13)      8
- ------------------------------- - ------------------------------- - -
                 6                                 6                  3

Plot the inflection point. The extra argument, [-9 6], in fplot extends the range of x values in the plot so that you see the inflection point more clearly, as shown in the following figure.

fplot(f, [-9 6])
hold on
plot(double(inflec_pt), double(subs(f,inflec_pt)),'ro')
title('Inflection Point of f')
text(-7,1,'Inflection point')
hold off

Was this topic helpful?