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.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

**MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.**

**MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.**

If a limit of a function at a particular value of a variable
does not exist, the `limit`

command
returns `undefined`

. For example, `tan(x)`

does
not have a bidirectional limit at
:

limit(tan(x), x = PI/2)

The plot of this function shows that the function can have two
different limits as the variable `x`

approaches the
value
from
the left and from the right:

plot(tan(x), x = -PI..PI)

To compute one-sided limits of a function, use the options `Left`

and `Right`

:

limit(tan(x), x = PI/2, Left); limit(tan(x), x = PI/2, Right)

If the function has a bidirectional limit at some point, one-sided limits are equal at this point. They also are equal to the bidirectional limit at this point:

Left = limit(abs(tan(x)), x = PI/2, Left); Right = limit(abs(tan(x)), x = PI/2, Right); Bidirectional = limit(abs(tan(x)), x = PI/2)

plot(abs(tan(x)), x = 0..PI)

Was this topic helpful?