Graphics Reference
In-Depth Information
Step
Example
view([30,25])
set(gca,'CameraViewAngleMode','Manual')
6.
Place the point of view
axis([5 15 5 15 -8 8])
set(gca,'ZTickLabel','Negative||Positive')
7.
Position limits and markings on shafts
set(gca, 'PlotBoxAspectRatio', [2.5 2.5 1])
8.
Set the aspect ratio
xlabel('X Axis')
ylabel('Y Axis')
zlabel('Function Value')
title('Peaks')
9.
Place annotationslegends, chart and axes
set(gcf,'PaperPositionMode','auto')
print -dps2
10. Print the chart
You can use some or all of these steps to create your graphic. So let's go through a few examples. As a first example
we consider the surface z = x 2 - y 2 in [-2,2] x [- 2,2] and represent it with strong lighting, shading dense grayish colors
(Figure 5-25 ).
>> [X, and] = meshgrid(-2:0.05:2);
Z = X .^ 2 - Y .^ 2;
surf(X,Y,Z),shading interp,brighten(0.75),colormap(gray(5))
Figure 5-25.
Then we represent, on the same axes, the curve focused from four different points of view and with shading by
default (Figure 5-26 ).
>> [X, Y] = meshgrid(-2:0.05:2);
Z = X .^ 2 - Y .^ 2;
subplot(2,2,1)
surf(X,Y,Z)
subplot(2,2,2)
 
Search WWH ::




Custom Search