调用cylinder和sphere函数绘制柱面、哑铃面、球面和椭球面
>> % 绘制圆柱面
>> subplot(2,2,1);
>> [x,y,z]=cylinder;
>> surf(x,y,z);
>> title('圆柱面')
>>
>> % 绘制哑铃面
>> subplot(2,2,2);
>> t=0:pi/10:2*pi;
>> [X,Y,Z]=cylinder(2+cos(t));
>> surf(X,Y,Z);
>> title('哑铃面')
>>
>> %绘制球面,半径为10,球心(1,1,1)
>> subplot(2,2,3);
>> [x,y,z]=sphere;
>> surf(10*x+1,10*y+1,10*z+1);
>> axis equal;
>> title('球面')
>>
>> %绘制椭球面
>> subplot(2,2,4);
>> a=4;
>> b=3;
>> t=-b:b/10:b;
>> [x,y,z]=cylinder(a*sqrt(1-t.^2/b^2),30);
>> surf(x,y,z);
>> title('椭球面')
>>