MATLAB Function Reference |
Easy to use combination mesh/contour plotter
Syntax
ezmeshc(fun) ezmeshc(fun,domain) ezmeshc(funx,funy,funz) ezmeshc(funx,funy,funz,[smin,smax,tmin,tmax]) or ezmeshc(funx,funy,funz,[min,max]) ezmeshc(...,n) ezmeshc(...,'circ') ezmeshc(axes_handle,...) h = ezmeshc(...)
Description
ezmeshc(fun)
creates a graph of fun(x,y)
using the meshc
function. fun
is plotted over the default domain -2 < x < 2, -2 < y < 2.
fun
can be a function handle for an M-file function or an anonymous function (see Function Handles and Anonymous Functions) or a string (see the Remarks section).
ezmeshc(fun,domain)
plots fun
over the specified domain
. domain
can be either a 4-by-1 vector [xmin
, xmax
, ymin
, ymax
] or a 2-by-1 vector [min
, max
] (where min
< x < max
, min
< y < max
).
ezmeshc(funx,funy,funz)
plots the parametric surface funx(s,t)
, funy(s,t)
, and funz(s,t)
over the square: -2 < s
< 2, -2 < t
< 2.
ezmeshc(funx,funy,funz,[smin,smax,tmin,tmax]) or
ezmeshc(funx,funy,funz,[min,max])
plots the parametric surface using the specified domain.
ezmeshc(...,n)
plots fun
over the default domain using an n
-by-n
grid. The default value for n
is 60.
ezmeshc(...,'circ')
plots fun
over a disk centered on the domain.
ezmesh(axes_handle,...)
plots into the axes with handle axes_handle
instead of the current axes (gca
).
h = ezmeshc(...)
returns the handle to a surface object in h
.
Passing the Function as a String
Array multiplication, division, and exponentiation are always implied in the string expression you pass to ezmeshc
. For example, the MATLAB syntax for a mesh/contour plot of the expression
That is, x^2
is interpreted as x.^2
in the string you pass to ezmeshc
.
If the function to be plotted is a function of the variables u and v (rather than x and y), then the domain endpoints umin
, umax
, vmin
, and vmax
are sorted alphabetically. Thus, ezmeshc('u^2 - v^3',[0,1],[3,6])
plots u2 - v3 over 0 < u < 1, 3 < v < 6.
Passing a Function Handle
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 ezmeshc
.
Note that when using function handles, you must use the array power, array multiplication, and array division operators (.^, .*, ./
) since ezmeshc
does not alter the syntax, as in the case with string inputs.
Passing Additional Arguments
If your function has additional parameters, for example k
in myfun
:
then you can use an anonymous function to specify that parameter:
Examples
Create a mesh/contour graph of the expression
over the domain -5 < x < 5, -2*pi < y < 2*pi:
Use the mouse to rotate the axes to better observe the contour lines (this picture uses a view of azimuth = -65.5 and elevation = 26)
See Also
ezmesh
, ezsurfc
, function_handle
, meshc
Function Plots for related functions
ezmesh | ezplot |
© 1994-2005 The MathWorks, Inc.