Tuesday, August 4, 2009

ezpolar

Easy to use polar coordinate plotter

Syntax

  • ezpolar(f)
    
    ezpolar(f,[a,b])

Description

ezpolar(f) plots the polar curve rho = f(theta) over the default domain 0 < src="http://www.physiol.ox.ac.uk/Computing/Online_Documentation/Matlab/techdoc/ref/pi.gif" align="bottom">.

ezpolar(f,[a,b]) plots f for a < theta < b.

Examples

This example creates a polar plot of the function,

    1 + cos(t)

over the domain [0, 2]:

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




ezsurf

Easy to use 3-D colored surface plotter

Syntax

  • ezsurf(f)
    
    ezsurf(f,domain)
    ezsurf(x,y,z)
    ezsurf(x,y,z,[smin,smax,tmin,tmax]) or ezsurf(x,y,z,[min,max])
    ezsurf(...,n)
    ezsurf(...,'circ')

Description

ezsurf(f) creates a graph of f(x,y), where f is a string that represents a mathematical function of two variables, such as x and y.

The function f is plotted over the default domain: -2 < x < src="http://www.physiol.ox.ac.uk/Computing/Online_Documentation/Matlab/techdoc/ref/pi.gif" align="bottom">, -2 < y < src="http://www.physiol.ox.ac.uk/Computing/Online_Documentation/Matlab/techdoc/ref/pi.gif" align="bottom">. MATLAB chooses the computational grid according to the amount of variation that occurs; if the function f is not defined (singular) for points on the grid, then these points are not plotted.

ezsurf(f,domain) plots f 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 <>y <>

If f 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, ezsurf('u^2 - v^3',[0,1],[3,6]) plots u2 - v3 over 0 < u <>v <>

ezsurf(x,y,z) plots the parametric surface x = x(s,t), y = y(s,t), and z = z(s,t) over the square: -2 < s < src="http://www.physiol.ox.ac.uk/Computing/Online_Documentation/Matlab/techdoc/ref/pi.gif" align="bottom">, -2 < t < src="http://www.physiol.ox.ac.uk/Computing/Online_Documentation/Matlab/techdoc/ref/pi.gif" align="bottom">.

ezsurf(x,y,z,[smin,smax,tmin,tmax]) or ezsurf(x,y,z,[min,max]) plots the parametric surface using the specified domain.

ezsurf(...,n) plots f over the default domain using an n-by-n grid. The default value for n is 60.

ezsurf(...,'circ') plots f over a disk centered on the domain.

Remarks

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

  • sqrt(x.^2 + y.^2);
    

is written as:

  • ezsurf('sqrt(x^2 + y^2)')
    

That is, x^2 is interpreted as x.^2 in the string you pass to ezsurf.

Examples

ezsurf does not graph points where the mathematical function is not defined (these data points are set to NaNs, which MATLAB does not plot). This example illustrates this filtering of singularities/discontinuous points by graphing the function,

over the default domain -2 < x < src="http://www.physiol.ox.ac.uk/Computing/Online_Documentation/Matlab/techdoc/ref/pi.gif" align="bottom">, -2 < y < src="http://www.physiol.ox.ac.uk/Computing/Online_Documentation/Matlab/techdoc/ref/pi.gif" align="bottom">:

  • ezsurf('real(atan(x+i*y))')
    



Using surf to plot the same data produces a graph without filtering of discontinuities (as well as requiring more steps):

  • [x,y] = meshgrid(linspace(-2*pi,2*pi,60));
    
    z = real(atan(x+i.*y));
    surf(x,y,z)



Note also that ezsurf creates graphs that have axis labels, a title, and extend to the axis limits.




ezsurfc
Easy to use combination surface/contour plotter

Syntax

  • ezsurfc(f)
    
    ezsurfc(f,domain)
    ezsurfc(x,y,z)
    ezsurfc(x,y,z,[smin,smax,tmin,tmax]) or ezsurfc(x,y,z,[min,max])
    ezsurfc(...,n)
    ezsurfc(...,'circ')

Description

ezsurfc(f) creates a graph of f(x,y), where f is a string that represents a mathematical function of two variables, such as x and y.

The function f is plotted over the default domain: -2 < x < src="http://www.physiol.ox.ac.uk/Computing/Online_Documentation/Matlab/techdoc/ref/pi.gif" align="bottom">, -2 < y < src="http://www.physiol.ox.ac.uk/Computing/Online_Documentation/Matlab/techdoc/ref/pi.gif" align="bottom">. MATLAB chooses the computational grid according to the amount of variation that occurs; if the function f is not defined (singular) for points on the grid, then these points are not plotted.

ezsurfc(f,domain) plots f 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 <>y <>

If f 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, ezsurfc('u^2 - v^3',[0,1],[3,6]) plots u2 - v3 over 0 < u <>v <>

ezsurfc(x,y,z) plots the parametric surface x = x(s,t), y = y(s,t), and z = z(s,t) over the square: -2 < s < src="http://www.physiol.ox.ac.uk/Computing/Online_Documentation/Matlab/techdoc/ref/pi.gif" align="bottom">, -2 < t < src="http://www.physiol.ox.ac.uk/Computing/Online_Documentation/Matlab/techdoc/ref/pi.gif" align="bottom">.

ezsurfc(x,y,z,[smin,smax,tmin,tmax]) or ezsurfc(x,y,z,[min,max]) plots the parametric surface using the specified domain.

ezsurfc(...,n) plots f over the default domain using an n-by-n grid. The default value for n is 60.

ezsurfc(...,'circ') plots f over a disk centered on the domain.

Remarks

Array multiplication, division, and exponentiation are always implied in the expression you pass to ezsurfc. For example, the MATLAB syntax for a surface/contour plot of the experssion,

  • sqrt(x.^2 + y.^2);
    

is written as:

  • ezsurfc('sqrt(x^2 + y^2)')
    

That is, x^2 is interpreted as x.^2 in the string you pass to ezsurfc.

Examples

Create a surface/contour plot of the expression,

over the domain -5 < x <>y <>

  • ezsurfc('y/(1 + x^2 + y^2)',[-5,5,-2*pi,2*pi],35)
    

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)


No comments:

Post a Comment