3-D Visualization Previous page   Next Page

Parametric Surfaces

The functions that draw surfaces can take two additional vector or matrix arguments to describe surfaces with specific x and y data. If Z is an m-by-n matrix, x is an n-vector, and y is an m-vector, then

describes a mesh surface with vertices having color C(i,j) and located at the points

where x corresponds to the columns of Z and y to its rows.

More generally, if X, Y, Z, and C are matrices of the same dimensions, then

describes a mesh surface with vertices having color C(i,j) and located at the points

This example uses spherical coordinates to draw a sphere and color it with the pattern of pluses and minuses in a Hadamard matrix, an orthogonal matrix used in signal processing coding theory. The vectors theta and phi are in the range -pi theta pi and -pi/2 phi pi/2. Because theta is a row vector and phi is a column vector, the multiplications that produce the matrices X, Y, and Z are vector outer products.


Previous page  Surface Plots of Nonuniformly Sampled Data Hidden Line Removal Next page

© 1994-2005 The MathWorks, Inc.