1.实验一:函数绘图实验
clc;clear;
a=1;
b=1;
x=[-10:0.1:10];
y=(b^2*(x.^2/a^2-1)).^0.5;
plot(x,y,'k');
title('x^2/a^2-y^2/b^2=1,x=-+b/a*x Asymptote')
hold on
plot(x,-y,'k')
plot(-x,y,'k')
plot(-x,-y,'k')
%渐近线
x=-10:0.1:10;
plot(x,b/a.*x,'r')
plot(x,-b/a.*x,'r')
hold off
clear ; clc
t=0:0.1:pi;
r=0:0.1:2*pi;
[r,t]=meshgrid(r,t);
x1=1*sin(t).*cos(r);
y1=1*sin(t).*sin(r);
z1=1*cos(t);
mesh(x1,y1,z1);
hold on
xgrid = -1:0.1:1;
ygrid = -1:0.1:1;
[x,y] = meshgrid(xgrid,ygrid);
z_p = sqrt(x.^2+y.^2);
z_n = -sqrt(x.^2+y.^2);
mesh(x,y,z_p);
hold on;
mesh(x,y,z_n);
axis equal;
axis('square')
xlabel('X-axis');ylabel('Y-axis');zlabel('Z-axis');
shading flat;
title('The surface of intersecting sphere and cone');
clc;
clear;
t=0:0.1:pi;
r=0:0.1:2*pi;
[r,t]=meshgrid(r,t);
##The rectangular coordinate equation of the
## ball is transformed into polar coordinate equation
##x^2+y^2+z^2=9
x1=3*sin(t).*cos(r);
y1=3*sin(t).*sin(r);
z1=3*cos(t);
##Polar coordinate equation of cylinder
##x^2+z^2=4
u=0:0.1:2*pi;
v=-3:0.1:3;
[u,v]=meshgrid(u,v);
x2=2*cos(u);
y2=v;
z2=2*sin(u);
mesh(x1,y1,z1)
hold on
mesh(x2,y2,z2)
xlabel('X-axis');ylabel('Y-axis');zlabel('Z-axis');
shading flat;
title('The surface of intersecting sphere and cylinder');
hold off
2.实验二:微积分实验