Mathematics |

**Plotting Mathematical Functions**

The `fplot`

function plots a mathematical function between a given set of axes limits. You can control the *x*-axis limits only, or both the *x*- and *y*-axis limits. For example, to plot the `humps`

function over the *x*-axis range `[-5 5]`

, use

You can zoom in on the function by selecting *y*-axis limits of `-10`

and `25`

, using

You can also pass an inline for `fplot`

to graph, as in

You can plot more than one function on the same graph with one call to `fplot`

. If you use this with a function, then the function must take a column vector `x`

* *and return a matrix where each column corresponds to each function, evaluated at each value of `x`

.

If you pass an inline object of several functions to `fplot`

, the inline object also must return a matrix where each column corresponds to each function evaluated at each value of `x`

*, *as in

which plots the first and second functions on the same graph.

evaluates to a matrix of two columns, one for each function, when `x`

is a column vector.

Representing Functions in MATLAB | Minimizing Functions and Finding Zeros |