# sphere

## Purpose

Generate sphere.

## Synopsis

    [X,Y,Z] = sphere(n)
    sphere(n)
    sphere

## Description

`sphere` generates the x-, y-, and z-coordinates of a unit sphere for use with `surf` and `mesh`.

`[X,Y,Z] = sphere(n)` returns the coordinates of a sphere in three `(n+1)`-by-`(n+1)` matrices. You can graph the sphere with

    surf(X,Y,Z)

`sphere(n)`, with no output arguments, draws a `surf` plot of the sphere on the screen.

`sphere` with no input arguments defaults to `n = 20`.

## Examples

Generate and plot a sphere:

    [X,Y,Z] = sphere(10);
    mesh(X,Y,Z)

## ``See Also

    cylinder

(c) Copyright 1994 by The MathWorks, Inc.