Navigation

Operators and Keywords

Function List:

C++ API

: ezplot (f)
: ezplot (f2v)
: ezplot (fx, fy)
: ezplot (…, dom)
: ezplot (…, n)
: ezplot (hax, …)
: h = ezplot (…)

Plot the 2-D curve defined by the function f.

The function f may be a string, inline function, or function handle and can have either one or two variables. If f has one variable, then the function is plotted over the domain -2*pi < x < 2*pi with 500 points.

If f2v is a function of two variables then the implicit function f(x,y) = 0 is calculated over the meshed domain -2*pi <= x |y <= 2*pi with 60 points in each dimension.

For example:

ezplot (@(x, y) x.^2 - y.^2 - 1)

If two functions are passed as inputs then the parametric function

x = fx (t)
y = fy (t)

is plotted over the domain -2*pi <= t <= 2*pi with 500 points.

If dom is a two element vector, it represents the minimum and maximum values of both x and y, or t for a parametric plot. If dom is a four element vector, then the minimum and maximum values are [xmin xmax ymin ymax].

n is a scalar defining the number of points to use in plotting the function.

If the first argument hax is an axes handle, then plot into this axis, rather than the current axes returned by gca.

The optional return value h is a vector of graphics handles to the created line objects.

See also: plot, ezplot3, ezpolar, ezcontour, ezcontourf, ezmesh, ezmeshc, ezsurf, ezsurfc.

Demonstration 1

The following code

 ## sinc function using function handle
 f = @(x) sin (pi*x) ./ (pi*x);
 ezplot (f);

Produces the following figure

Figure 1

Demonstration 2

The following code

 ## example of a function string and explicit limits
 clf;
 ezplot ("1/x", [-2 2]);

Produces the following figure

Figure 1

Demonstration 3

The following code

 ## parameterized function example over -2*pi <= t <= +2*pi
 clf;
 ezplot (@cos, @sin);

Produces the following figure

Figure 1

Demonstration 4

The following code

 ## implicit function of 2 variables
 clf;
 ezplot (inline ("x^2 - y^2 - 1"));

Produces the following figure

Figure 1

Package: octave