3.5 Space Curves in Matlab
3.5 Space Curves in Matlab
3.5 Space Curves in Matlab
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Section <strong>3.5</strong> <strong>Space</strong> <strong>Curves</strong> <strong>in</strong> <strong>Matlab</strong> 245<br />
Figure 3.3. Superimpos<strong>in</strong>g the spherical spiral on a transparent<br />
sphere.<br />
Such is the case with a space curve known as Viviani’s Curve, which is the<br />
<strong>in</strong>tersection of a sphere of radius 2r (centered at the orig<strong>in</strong>) and a right-circular<br />
cyl<strong>in</strong>der of radius r that is shifted r units along either the x- or y-axis.<br />
The equation of the sphere is x 2 + y 2 + z 2 = 4r 2 . We know that this sphere<br />
can be produced by the parametric equations<br />
x = 2r s<strong>in</strong> φ cos θ<br />
y = 2r s<strong>in</strong> φ s<strong>in</strong> θ<br />
z = 2r cos φ.<br />
(3.4)<br />
We offer the follow<strong>in</strong>g construction with few comments. It is similar to what we<br />
did <strong>in</strong> Example 2.<br />
r=1;<br />
phi=l<strong>in</strong>space(0,pi,30);<br />
theta=l<strong>in</strong>space(0,2*pi,40);<br />
[phi,theta]=meshgrid(phi,theta);<br />
x=2*r*s<strong>in</strong>(phi).*cos(theta);<br />
y=2*r*s<strong>in</strong>(phi).*s<strong>in</strong>(theta);<br />
z=2*r*cos(phi);<br />
Handle graphics are employed to color edges.