where the x, y, and z are the coordinates of the points on the surface. The function surf draws a surface composed of colored patches, whereas mesh draws
white surface patches that are defined by thei
Section 7.1
7.1 Plot the following three-dimensional curves. Use axis equal.
Name
Parameter values
Equations
Spherical
helix6
c = 5.0; 0 w 10p
x = sin(w/2c) cosw
y = sin(w/2c) sinw
z = cos(w/2c)
Toroi
368
Chapter 7
3D Graphics
hold on
mesh(Xr, Yr, Zr)
text(0.5, -0.5, 1,'\phi = 60\circ')
case 3
psi = pi/3; chi = 0; phi = 0;
[Xr Yr Zr] = EulerAngles(psi,chi,phi,Lx,Ly,Lz,X,Y,Z);
mesh(X, Y, Z)
hold on
7.3 SUMMARY OF FUNCTIONS INTRODUCED IN CHAPTER 7
In Table 7.10, we have summarized the plotting functions introduced in Chapter 7.
TABLE 7.10 MATLAB Functions Introduced in Chapter 7
MATLAB function
D
We now illustrate the use of these transformation equations with the manipulation of a torus, whose coordinates are given by5
x = r cosu
y = r sinu
z = ; 4a 2 -
A 2x2 + y2 - b B 2
where b - a r b + a,
[x, y, z, L] = PlanarSurface([0 0 0], [2 6 3], [7 1 5]);
surf(x, y, z)
PlanarSurfaceProj([0 0 0], [2 6 3], [7 1 5])
we obtain the results shown in Figure 7.11. Although there is an illusion that the p
and for the projection onto the xz-plane
P # (i + 0j + k)
Thus, we create a new function M file PlanarSurfaceProj to obtain these
projections.
function PlanarSurfaceProj(P0, P1, P2)
[xx, yy, zz, L] =
equal to 2a, minor axis in the y-direction equal to 2b, and minor axis in the z-direction
equal to 2c, the ratio of the volume of an ellipsoid to the volume of a sphere is
given by
V =
Vellipse
Vspher
S = 0:0.2:1;
L = length(S);
[s, t] = meshgrid(S, S);
xx = P0(1)+s*v(1)+t*w(1);
yy = P0(2)+s*v(2)+t*w(2);
zz = P0(3)+s*v(3)+t*w(3);
where P0, P1, and P2 are each three-element vectors containing the co
Name
Parameter values
Equations
Hyperbolic
helicoid17
t = 7; -p u p,
0 v 0.5
x =
Apple
surface18
0 u 2p, -p v p
[Use the transparency option
to view interior]
sinh(v) cos(tu)
1 + cosh(u) cosh(v)
sinh(
7.2 Plot the following surfaces. Use axis equal vis3d. Use the Rotate 3D icon to get a better understanding of the surface. In some cases, the use of shading interp will improve
the image.
Name
Parame
Histogram
20
18
Number of occurrences
16
14
Cumulative distribution
1
Mean = 162.7
Median = 161.5
Geometric mean = 159
Standard deviation = 33.77
No. of samples = 80
Minimum = 76
Maximum = 245
Range =
k
ck = cumsum(f)
where f = [f1 f2 fk] = [n1/n n2/n nk/n]. We can also plot ck versus bk , which is
an approximation to the probability that a measurement has a value less than or
equal to bk .
Now let
and sample variance is
n
1
c a x2 - nx2 d
q
n - 1 j=1 j
s2 =
(8.2)
where s is the standard deviation. These quantities are the estimates of the true
mean m and the true standard deviation s. The mean
7.9 Consider a thin rectangular plate with a circular hole of radius a that is subjected to a
uniform tension of magnitude S in the x-direction. The radial, tangential, and shear
stresses are, respect
7.5 Plot the following mode shape and its contours for a square membrane clamped on its
outer boundary using twenty-five grid points in each direction for 0 x 1 and
0 y 1:
w23(x, y) = sin(2px) sin(3py
Four additional ways to visually enhance the surface generated by SurfExample
are illustrated in Table 7.4.
Contour Plots
Surfaces can also be transformed into various contour plots, which are plots o
TABLE 7.2 Continued
Plotting function
Script
Graph
box on
axis on
grid off
[x, y, z] = SurfExample;
mesh(x, y, z)
box on
axis on
grid off
200
150
100
50
0
15
10
4
2
5
0
0
2
5
4
As mentioned previously
Reversing One Axis
The portions of the disc, lines, and surface that were not visible in Figure 7.4a can be
viewed by reversing one of the display axes. This reversal is implemented with
axis ij
When
Section 7.2
Surfaces
343
TABLE 7.1 Illustration of the Difference between surf, mesh, and mesh without Hidden Line Removal
Plotting function
Script
surf
Graph
[x, y, z] = SurfExample;
surf(x, y, z)
20
increments in the circumferential direction. The script to plot a cylindrical surface
with this profile is
zz = linspace(0, 2*pi, 26);
[x, y, z] = cylinder(1.1+sin(zz), 16);
surf(x, y, z)
axis off
whi