23.12.2012 Views

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

3. Add the Slice Planes<br />

coneplot<br />

• Calculate the magnitude of the vector field (which represents wind speed) to<br />

generate scalar data for the slice command.<br />

• Create slice planes along the x-axis at xmin and xmax, along the y-axis at<br />

ymax, and along the z-axis at zmin.<br />

• Specify interpolated face color so the slice coloring indicates wind speed and<br />

do not draw edges (hold, slice, FaceColor, EdgeColor).<br />

hold on<br />

wind_speed = sqrt(u.^2 + v.^2 + w.^2);<br />

hsurfaces = slice(x,y,z,wind_speed,[xmin,xmax],ymax,zmin);<br />

set(hsurfaces,'FaceColor','interp','EdgeColor','none')<br />

hold off<br />

4. Define the View<br />

• Use the axis command to set the axis limits equal to the range of the data.<br />

• Orient the view to azimuth = 30 and elevation = 40 (rotate3d is a useful<br />

command for selecting the best view).<br />

• Select perspective projection to provide a more realistic looking volume<br />

(camproj).<br />

• Zoom in on the scene a little to make the plot as large as possible (camzoom).<br />

axis tight; view(30,40); axis off<br />

camproj perspective; camzoom(1.5)<br />

5. Add Lighting to the Scene<br />

The light source affects both the slice planes (surfaces) and the cone plots<br />

(patches). However, you can set the lighting characteristics of each<br />

independently.<br />

• Add a light source to the right of the camera and use Phong lighting give the<br />

cones and slice planes a smooth, three-dimensional appearance (camlight,<br />

lighting).<br />

• Increase the value of the AmbientStrength property for each slice plane to<br />

improve the visibility of the dark blue colors. (Note that you can also specify<br />

a different colormap to change to coloring of the slice planes.)<br />

2-307

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

Saved successfully!

Ooh no, something went wrong!