Plot expression or function
fplot(
plots the
curve defined by the function f
)y = f(x)
over the
default interval [-5 5]
for x
.
fplot(___,
specifies
the line style, marker symbol, and line color. For example, LineSpec
)'-r'
plots
a red line. Use this option after any of the input argument combinations
in the previous syntaxes.
fplot(___,
specifies
line properties using one or more name-value pair arguments. For example, Name,Value
)'LineWidth',2
specifies
a line width of 2 points.
fplot(
plots
into the axes specified byax
,___)ax
instead of the current
axes (gca
). Specify the axes as the first input
argument.
returns
a fp
= fplot(___)FunctionLine
object or a ParameterizedFunctionLine
object,
depending on the inputs. Use fp
to query and modify
properties of a specific line. For a list of properties, see FunctionLine Properties or ParameterizedFunctionLine Properties.
[x,y] =
fplot(___)
returns the abscissas and ordinates for
the function without creating a plot. This syntax will be removed in a future
release. Use the XData
and YData
properties of the line object, fp
, instead.
Note
fplot
no longer supports input arguments for
specifying the error tolerance or the number of evaluation points. To
specify the number of evaluation points, use the MeshDensity
property.
Use element-wise operators for the best performance
and to avoid a warning message. For example, use x.*y
instead
of x*y
. For more information, see Array vs. Matrix Operations.
When you zoom in on the chart, fplot
replots
the data, which can reveal hidden details.