fcontour

Contour plot of a function of two variables, given as a handle.

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

Syntax

fcontour(f)

Draws contour lines of f(x,y) over the default domain -5 < x < 5, -5 < y < 5.

fcontour(f, [min max])

Uses the same interval for both variables.

fcontour(f, [xmin xmax ymin ymax])

Sets the interval of each variable.

fcontour(___, Name, Value)

Sets options such as 'Fill', 'LevelList' or 'MeshDensity'.

Description

fcontour samples f on a grid and draws the level curves in the current axes. Because it takes a function rather than data, the plot always covers exactly the requested domain.

Input arguments

f
Function handle that takes x and y arrays and returns an array of the same size.
'Fill'
'on' fills the regions between levels.
'LevelList'
Vector of the contour levels to draw.

Example

Filled levels

fcontour(@(x,y) sin(x).*cos(y), [-pi pi], 'Fill', 'on')
colorbar

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

Notes

In MatLivre, calling fcontour with an output argument returns the numeric contour matrix instead of a graphics handle.

See also

contour ezcontour fsurf fimplicit meshgrid