(Not recommended) Easy-to-use function plotter
ezplot
is not recommended. Use fplot
instead.
ezplot(fun)
ezplot(fun,[xmin,xmax])
ezplot(fun2)
ezplot(fun2,[xymin,xymax])
ezplot(fun2,[xmin,xmax,ymin,ymax])
ezplot(funx,funy)
ezplot(funx,funy,[tmin,tmax])
ezplot(...,fig)
ezplot(ax,...)
h = ezplot(...)
ezplot(fun)
plots the expression
fun(x)
over the default domain -2π < x
< 2π,
where fun(x)
is an explicit function of only x
.
fun
can be a function handle, a character vector, or a string.
ezplot(fun,[xmin,xmax])
plots
fun(x)
over the domain: xmin
< x
< xmax
.
For an implicit function, fun2(x,y)
:
ezplot(fun2)
plots fun2(x,y) =
0
over the default domain -2π < x
< 2π, -2π <
y
< 2π.
ezplot(fun2,[xymin,xymax])
plots
fun2(x,y) = 0
over xymin
< x
< xymax
and xymin
< y
<
xymax
.
ezplot(fun2,[xmin,xmax,ymin,ymax])
plots
fun2(x,y) = 0
over xmin
< x
< xmax
and ymin
< y
<
ymax
.
ezplot(funx,funy)
plots the parametrically
defined planar curve funx(t)
and funy(t)
over the
default domain 0 < t
< 2π.
ezplot(funx,funy,[tmin,tmax])
plots
funx(t)
and funy(t)
over tmin
<
t
< tmax
.
ezplot(...,fig)
plots into the figure window
identified by fig
. Use any of the input argument combinations in the
previous syntaxes that include a domain. The domain options are [xmin
xmax]
, [xymin xymax]
, [xmin xmax ymin ymax]
,
and [tmin tmax]
.
ezplot(ax,...)
plots into the axes
ax
instead of the current axes (gca
).
h = ezplot(...)
returns either a chart line or
contour object.
Array multiplication, division, and exponentiation are always implied in the expression
you pass to ezplot
. For example, the MATLAB® syntax for a plot of the expression
x.^2 - y.^2
which represents an implicitly defined function, is written as
ezplot('x^2 - y^2')
That is, x^2
is interpreted as x.^2
in the
character vector or string you pass to ezplot
.
Function handle arguments must point to functions that use MATLAB syntax. For example, the following statements define an anonymous function and
pass the function handle fh
to ezplot
.
fh = @(x,y) x.^2 + y.^3 - 2*y - 1; ezplot(fh) axis equal
Note that when using function handles, you must use the array power, array
multiplication, and array division operators (.^, .*, ./
) since
ezplot
does not alter the syntax, as in the case with character
vector or string inputs.
If your function has additional parameters, for example k
in
myfun
:
function z = myfun(x,y,k) z = x.^k - y.^k - 1;
then you can use an anonymous function to specify that parameter:
ezplot(@(x,y)myfun(x,y,2))