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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

slice• Create a slice surface in the domain of the volume (surf, linspace).• Orient this surface with respect the the axes (rotate).• Get the XData, YData, and ZData of the surface (get).• Use this data to draw the slice plane within the volume.For example, these statements slice the volume in the first example with arotated plane. Placing these commands within a for loop “passes” the planethrough the volume along the z-axis.for i = −2:.5:2hsp = surf(linspace(−2,2,20),linspace(−2,2,20),zeros(20)+i);rotate(hsp,[1,−1,1],30)xd = get(hsp,’XData’);yd = get(hsp,’YData’);zd = get(hsp,’ZData’);delete(hsp)slice(x,y,z,v,[−2,2],2,-2) % Draw some volume boundarieshold onslice(x,y,z,v,xd,yd,zd)hold offaxis tightview(−5,10)drawnowend2-446

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

Saved successfully!

Ooh no, something went wrong!