12.07.2015 Views

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

patchVertices Faces FaceVertexCDataRequired forDimensions Dimensions Indexed True ColorResults Obtainedm-by-n k-by-3 k-by-1 k-by-3 Use one color for each patch face. Edgescan be only a single color.m-by-n k-by-3 m-by-1 m-by-3 Assign a color to each vertex. patch facescan be flat (a single color) orinterpolated. Edges can be flat orinterpolated.ExamplesThis example creates a patch object using two different methods:• Specifying x-, y-, and z-coordinates and color data (XData, YData, ZData, andCData properties).• Specifying vertices, the connection matrix, and color data (Vertices, Faces,FaceVertexCData, and FaceColor properties).Specifying X, Y, and Z CoordinatesThe first approach specifies the coordinates of each vertex. In this example, thecoordinate data defines two triangular faces, each having three vertices. Usingtrue color, the top face is set to white and the bottom face to gray.x = [0 0;0 1;1 1];y = [1 1;2 2;2 1];z = [1 1;1 1;1 1];tcolor(1,1,1:3) = [1 1 1];tcolor(1,2,1:3) = [.7 .7 .7];patch(x,y,z,tcolor)2-316

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!