Documentation

ezpolar

Easy-to-use polar coordinate plotter

Syntax

ezpolar(fun)
ezpolar(fun,[a,b])
ezpolar(axes_handle,...)
h = ezpolar(...)

Description

ezpolar(fun)plots the polar curverho = fun(theta)over the default domain 0 <theta< 2π.

funcan be a function handle or a character vector (see theTipssection).

ezpolar(fun,[a,b])plotsfunfora<theta<b.

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

h = ezpolar(...)returns the handle to a line object inh.

Examples

collapse all

Plot the functionover the domain.

figure ezpolar('1+cos(t)')

Tips

Passing the Function as a Character Vector

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

t.^2.*cos(t)

which represents an implicitly defined function, is written as

ezpolar('t^2*cos(t)')

That is,t^2is interpreted ast.^2in the character vector you pass toezpolar.

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

fh = @(t) t.^2.*cos(t); ezpolar(fh)

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

Passing Additional Arguments

If your function has additional parameters, for examplek1andk2inmyfun:

function s = myfun(t,k1,k2) s = sin(k1*t).*cos(k2*t);

then you can use an anonymous function to specify the parameters:

ezpolar(@(t)myfun(t,2,3))

Introduced before R2006a

Was this topic helpful?