| Symbolic Math Toolbox | ![]() |
Calculus Example
This section describes how to analyze a simple function to find its asymptotes, maximum, minimum, and inflection point. The section covers the following topics:
Defining the Function
The function in this example is
To create the function, enter the following commands:
You can plot the graph of f by entering
This displays the following plot.
Finding the Asymptotes
To find the horizontal asymptote of the graph of f, take the limit of f as x approaches positive infinity:
The limit as x approaches negative infinity is also 3. This tells you that the line
y = 3 is a horizontal asymptote to the graph.
To find the vertical asymptotes of f, set the denominator equal to 0 and solve by entering the following command:
This returns to solutions to
:
This tells you that vertical asymptotes are the lines
You can plot the horizontal and vertical asymptotes with the following commands:
ezplot(f) hold on % Keep the graph of f in the figure % Plot horizontal asymptote plot([-2*pi 2*pi], [3 3],'g') % Plot vertical asymptotes plot(double(roots(1))*[1 1], [-5 10],'r') plot(double(roots(2))*[1 1], [-5 10],'r') title('Horizontal and Vertical Asymptotes') hold off
Note that roots must be converted to double to use the plot command.
The preceding commands display the following figure.
To recover the graph of f without the asymptotes, enter
Finding the Maximum and Minimum
You can see from the graph that f has a local maximum somewhere between the points x = 2 and x = 3, and might have a local minimum between x = -4 and x = -2. To find the x-coordinates of the maximum and minimum, first take the derivative of f:
To simplify this expression, enter
You can display f1 in a more readable form by entering
Next, set the derivative equal to 0 and solve for the critical points:
It is clear from the graph of f that it has a local minimum at
You can plot the maximum and minimum of f with the following commands:
ezplot(f) hold on plot(double(crit_pts), double(subs(f,crit_pts)),'ro') title('Maximum and Minimum of f') text(-5.5,3.2,'Local minimum') text(-2.5,2,'Local maximum') hold off
This displays the following figure.
Finding the Inflection Point
To find the inflection point of f, set the second derivative equal to 0 and solve.
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.
To see the symbolic expression for the inflection point, enter
1/2 2/3 1/2 1/3 (676 + 156 13 ) + 52 + 16 (676 + 156 13 ) - 1/6 --------------------------------------------------- 1/2 1/3 (676 + 156 13 )
To plot the inflection point, enter
ezplot(f, [-9 6]) hold on plot(double(inflec_pt), double(subs(f,inflec_pt)),'ro') title('Inflection Point of f') text(-7,2,'Inflection point') hold off
The extra argument, [-9 6], in ezplot extends the range of x values in the plot so that you see the inflection point more clearly, as shown in the following figure.
| Taylor Series | Extended Calculus Example | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |