Graphics Reference
In-Depth Information
eXerCISe 3-4
Given the surface equation:
z = x 2 - y 2 - 2 < x, y < 2
represent it with strong lighting, dense shadows and gray colors. using the same axis, show four different points
of view and with the shading by default.
>> [X, Y] = meshgrid(-2:0.05:2);
>> surf(X,Y,Z),shading interp,brighten(0.75),colormap(gray(5))
this generates the graph in figure 3-14 .
Figure 3-14.
We will now present in figure 3-15 the surface focused from four different points of view. the syntax is as
follows:
>> [X, Y] = meshgrid(-2:0.05:2);
>> Z = X .^ 2 - Y .^ 2;
>> subplot(2,2,1)
>> surf(X,Y,Z)
>> subplot(2,2,2)
>> surf(X,Y,Z),view(-90,0)
>> subplot(2,2,3)
>> surf(X,Y,Z),view(60,30)
>> subplot(2,2,4)
>> surf (X, Y, Z), view (- 10, 30)
Search WWH ::




Custom Search