Graphics Reference
In-Depth Information
Figure 3-15.
3.9 Parametric Surfaces
MATLAB allows you to represent surfaces whose components depend on specified variations in parameters. To do
this, you can use the commands surf and mesh , by properly defining the variables x, and z .
Cylindrical and spherical coordinate surfaces are representable in MATLAB, parameterizing them in advance.
In terms of surfaces of revolution, they always require ranges, which allow their graphical representation with
MATLAB.
eXerCISe 3-5
Draw the surface of parametric coordinates:
x = 4cos(r) sec(t) y = 2sine(r) sec(t) z = tan(t) -2 p < r <2 p , - p < r < p
>> r = [-2*pi:0.1:2*pi]';
>> t = [-pi:0.1:pi];
>> X = 4 * cos(r) * sec(t);
>> Y = 2 * sin(r) * sec(t);
>> Z = ones(size(r)) * tan(t);
>> surf(X,Y,Z)
>> shading interp
note that “ones” as used above is a function that produces a vector or matrix that is populated by ones. similarly,
“zeros” is populated by zeroes.
 
Search WWH ::




Custom Search