Graphics Reference
In-Depth Information
Chapter 3
Three-Dimensional Graphics,
Warped Curves and Surfaces,
Contour Graphics
3.1 Three-Dimensional Graphics (3-D), Warped Curves
The basic commands that MATLAB uses to draw graphs that generate a line in three dimensions or warped curves
are the following:
plot3(X, Y, Z) draws the set of points (X, Y, Z) , where X , Y and Z are vectors. X , Y and Z can
also be arrays of the same size, in which case a graph is made for each triplet of rows and on
the same axis. For complex values of X, Y and Z , the imaginary parts are ignored.
plot3(X,Y,Z,S) draws the plot (X, Y, Z) with the settings defined in S . Usually S consists of
two-symbols between single quotes, the first of which sets the color of the line of the graph,
and the second sets the character to be used in the plotting. The possible values of colors
and characters have been already described to explain the command plot .
plot3(X1,Y1,Z1,S1,X2,Y2,Z2,S2,X3,Y3,Z3,S3,...) combines, on the same axes, graphs
defined for the quads (Xi, Yi, Zi, Si). It is a way of representing various functions on the
same graph.
Here is an example:
>> x = 0:pi/50:10*pi;
>> y = sin(x);
>> z = cos(x);
>> plot3(x, y, z)
This generates the graph in Figure 3-1 .
 
Search WWH ::




Custom Search