46. Use matlab to draw Vianni curve (matlab program)

1. Code

clear close all
syms stkur;
x1='2*sin(s)*cos(t)';y1='2*sin(s)*sin(t)';z1='2*cos(s)';
x2 ='-2*cos(k)*cos(k)';y2='2*sin(k)*cos(k)';z2='u'; subplot(1,2,1);ezmeshc(
x2 ,y2,z2,[0,pi,-2,2]); % draw cylindrical surface
 hold on;
ezsurf(x1,y1,z1,[-pi,pi,0,pi]); % draw spherical surface
title(' Spherical and cylindrical surfaces');
hold off;
x3='-2*cos(r)*cos(r)';y3='2*sin(r)*cos(r)';z3='2*sin( r)';
subplot(1,2,2); ezplot3(x3,y3,z3,[0,2*pi]);
title('Viviani curve')
 

2. Running results

 

Guess you like

Origin blog.csdn.net/m0_57943157/article/details/132198715