Step
|
Typical Code
|
- 1
. - Prepare your data
|
Z = peaks(20);
|
- 2
. - Select window and position plot
region within window
|
figure(1)
subplot(2,1,2)
|
- 3
. - Call 3-D graphing function
|
h = surf(Z);
|
- 4 a
. - Set colormap and shading
algorithm
|
colormap hot
shading interp
set(h,'EdgeColor','k')
|
- 4 b
. - Add lighting
|
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')
|
- 5
. - Set viewpoint
|
view([30,25])
set(gca,'CameraViewAngleMode','Manual')
|
- 6
. - Set axis limits and tick marks
|
axis([5 15 5 15 -8 8])
set(gca'ZTickLabel','Negative||Positive')
|
- 7
. - Set aspect ratio
|
set(gca,'PlotBoxAspectRatio',[2.5 2.5 1])
|
- 8
. - Annotate the graph with axis
labels, legend, and text
|
xlabel('X Axis')
ylabel('Y Axis')
zlabel('Function Value')
title('Peaks')
|
- 9
. - Print graph
|
set(gcf,'PaperPositionMode','auto')
print -dps2
|