ezcontour

Contour plot of a function of two variables given as a handle or expression, without building a grid.

Category: Graphics > 2-D and 3-D Plots

Syntax

ezcontour(f)

Draws contour lines of f(x,y) over the default domain, -2*pi < x < 2*pi and -2*pi < y < 2*pi.

ezcontour(f, domain)

Uses [min max] for both variables, or [xmin xmax ymin ymax].

h = ezcontour(___)

Also returns the graphics handle.

Description

ezcontour evaluates the function on an internal grid and draws its level curves, so there is no need to call meshgrid first. It is an older convenience function; fcontour does the same job with a different default domain and more options.

Input arguments

f
Function handle or character vector that depends on x and y. It must accept arrays.
domain
Two or four numbers that set the plotting region.

Output arguments

h
Handle to the contour object.

Example

Saddle surface

ezcontour(@(x,y) x.^2 - y.^2, [-2 2])

In the app, the figure is drawn below the code.

See also

ezcontourf fcontour contour ezsurf meshgrid