| Contents | Index |
This table illustrates typical steps involved in producing 3-D scenes containing either data graphs or models of 3-D objects. Example applications include pseudocolor surfaces illustrating the values of functions over specific regions and objects drawn with polygons and colored with light sources to produce realism. Usually, you follow either step 4 or step 5 (not both).
Step | Typical Code |
|---|---|
Z = peaks(20); | |
figure(1);subplot(2,1,2) | |
h = surf(Z); | |
colormap hot shading interp set(h,'EdgeColor','k') | |
light('Position',[-2,2,20])
lighting phong
material([0.4,0.6,0.5,30])
set(h,'FaceColor',[0.7 0.7 0],...
'BackFaceLighting','lit') | |
view([30,25]) set(gca,'CameraViewAngleMode','Manual') | |
axis([5 15 5 15 -8 8]) set(gca,'ZTickLabel','Negative||Positive') | |
set(gca,'PlotBoxAspectRatio',[2.5 2.5 1]) | |
xlabel('X Axis')
ylabel('Y Axis')
zlabel('Function Value')
title('Peaks') | |
set(gcf,'PaperPositionMode','auto') print -dps2 |
![]() | Creating 3-D Graphs | Line Plots of 3-D Data | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |