function graphic2d( A, color ) % GRAPHIC2D creates a 2-dimensional plot of the object defined % by the points in the matrix A. A can have either 2 % or 3 rows; when there are 3 rows, each column is % assumed to be the homogeneous coordinate of a point % in the (2-d) plane. % Written by Douglas B. Meade for use in Math 526, Fall 2001 % 09 October 2001 % % Contact information: % e-mail: meade@math.sc.edu % WWW: http://www.math.sc.edu/~meade/math526/ if nargin==1 color='b'; end [Nrow,Ncol] = size(A); if Nrow==2 scale = ones(1,Ncol); elseif Nrow==3 scale = A(3,:); else ERROR('Argument must have either 2 or 3 columns.'); end fill( A(1,:)./scale, A(2,:)./scale, color )