Documentation

ezplot3

(Not recommended) Easy-to-use 3-D parametric curve plotter

ezplot3is not recommended. Usefplot3instead.

Syntax

ezplot3(funx,funy,funz)
ezplot3(funx,funy,funz,[tmin,tmax])
ezplot3(...,'animate')
ezplot3(axes_handle,...)
h = ezplot3(...)

Description

ezplot3(funx,funy,funz)plots the spatial curvefunx(t),funy(t), andfunz(t)over the default domain 0 <t< 2π.

funx,funy, andfunzcan be function handles, character vectors, or strings (see theTipssection).

ezplot3(funx,funy,funz,[tmin,tmax])plots the curvefunx(t),funy(t), andfunz(t)over the domaintmin<t<tmax.

ezplot3(...,'animate')produces an animated trace of the spatial curve.

ezplot3(axes_handle,...)plots into the axes with handleaxes_handleinstead of the current axes (gca).

h = ezplot3(...)returns the handle to the plotted objects inh.

Examples

collapse all

Plot this parametric curve over the domain.

ezplot3('sin(t)','cos(t)','t',[0,6*pi])

Tips

Passing the Function as a Character Vector or String

Array multiplication, division, and exponentiation are always implied in the expression you pass toezplot3. For example, the MATLAB®syntax for a plot of the expression

x = s./2, y = 2.*s, z = s.^2;

which represents a parametric function, is written as

ezplot3('s/2','2*s','s^2')

That is,s/2is interpreted ass./2in the character vector or string you pass toezplot3.

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 handlefhtoezplot3.

fh1 = @(s) s./2; fh2 = @(s) 2.*s; fh3 = @(s) s.^2; ezplot3(fh1,fh2,fh3)

Note that when using function handles, you must use the array power, array multiplication, and array division operators (.^, .*, ./) sinceezplot3does not alter the syntax, as in the case with character vector or string inputs.

Passing Additional Arguments

If your function has additional parameters, for examplekinmyfuntk:

function s = myfuntk(t,k) s = t.^k.*sin(t);

那你这n use an anonymous function to specify that parameter:

ezplot3(@cos,@(t)myfuntk(t,1),@sqrt)

Introduced before R2006a

Was this topic helpful?