12.07.2015 Views

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

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.

hold onplot3(x(ind),y(ind),z(ind),’.’)The x, y domain <strong>of</strong> the extracted points can be shown clearly with anoverhead view:view(2)xyzshading flatThe associated z values can be shown with a side view:view(90,0)grid7.6 Nonrectangular Surface DomainsThe polarmesh function given on page 26 showed a conical functiondefined over a circular domain <strong>of</strong> x <strong>and</strong> y points. Let us now look abit more generally at how to define such nonrectangular domains forsurfaces.The st<strong>and</strong>ard matlab functions, including graphics functions, tendto like working with rectangular matrices: each row must have the samenumber <strong>of</strong> columns. For surfaces, this requirement applies to the x, y<strong>and</strong> z matrices that specify the surface. Let us demonstrate by way <strong>of</strong>an example. First we generate a rectangular domain <strong>of</strong> x <strong>and</strong> y points,with x going from −1 to1,<strong>and</strong>y going from 0 to 2:>> [x,y] = meshgrid(-1:1,1:3)c○ 2000 by CRC Press LLC

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

Saved successfully!

Ooh no, something went wrong!