# fplot

## Purpose

Plot the graph of a function.

## Synopsis

    fplot('function',limits)
    fplot('fstring',limits)
    fplot(...,'marker')
    fplot(...,'marker',tol)
    [x,y] = fplot(...)

## Description

`fplot('function',limits)` plots the function specified by `function` between the limits specified by the `limits` vector. `function` can be any MATLAB function name, including the name of a user-created function. `limits` can be a two-element vector specifying the x-axis limits for the plot, or a four-element vector specifying both x- and y-axis limits, `[xmin` `xmax` `ymin` `ymax]`.

`fplot('fstring',limits)` evaluates and plots `fstring`, a function string that includes a variable `x`, such as `'sin(x)'` or `'diric(x,10)'`.

`fplot(...,'marker')` specifies the marker type for the plot. By default, `fplot` uses only a solid line. Valid `marker` strings are `'-+'`, `'-x'`, `'-o'`, and `'-`*`'`.

`fplot(...,'marker',tol)` specifies the relative error tolerance `tol`. By default, `tol` is 2e-3.

`[x,y] = fplot(...)` returns the abscissae and ordinates for the function in the column vectors `x` and `y`. No plot is drawn on the screen. The function can then be plotted with `plot(x,y)`.

## Examples

Plot the hyperbolic tangent function from -2 to 2.

    fplot('tanh',[-2 2])

``The function defined in the M-file

    function y = myfun(x)
    y(:,1) = 200*sin(x(:))./x(:);
    y(:,2) = x(:).^2;

is graphed with the statement:

    fplot('myfun',[-20 20])

## ``See Also

    feval, plot

(c) Copyright 1994 by The MathWorks, Inc.