参数化曲面的绘制
clc clear %椎体 % r=0:0.02:1; % theta=0:0.02:2*pi; % [r1,theta1]=meshgrid(r,theta); % x=r1.*cos(theta1); % y=r1.*sin(theta1); % z=r1; %球体 % fai=0:0.02:pi; % theta=0:0.02:pi*2; % a=1 % [fai1,theta1]=meshgrid(fai,theta); % x=a.*sin(fai1).*cos(theta1); % y=a.*sin(fai1).*sin(theta1); % z=a.*cos(fai1); %圆柱体 theta=0:0.02:pi; u=0:0.02:5; [theta1,u1]=meshgrid(theta,u); x=3.*sin(2.*theta1); y=6.*sin(theta1).^2; z=u1; surf(x,y,z); axis equal
%柱面 % x=0:0.02:1; % z=0:0.02:4; % [x1,z1]=meshgrid(x,z); % x=x1; % y=x1.^2; % z=z1; % % hold on % quiver3(1/2, 1/4, 1/2,1/10,1/10,0/10,'g') % quiver3(1/2, 1/4, 1/2,0/10,0/10,1/7,'r') % quiver3(1/2, 1/4, 1/2,1/10,-1/10,0,'y') %抛物面 r=0:0.02:2; theta=0:0.02:2*pi; [r1,theta1]=meshgrid(r,theta); x=r1.*cos(theta1); y=r1.*sin(theta1); z=r1.^2;
空间椭圆曲线参数方程
x+y+z=1 切 x^2+y^2=3形成的空间椭圆
x=3 cos(theta)
y=3 sin(theta)
z=1-x-y
椭圆切面参数方程
theta=0:0.03:2*pi; r=0:0.05:3; [r1,theta1]=meshgrid(r,theta); x=r1.*cos(theta1); y=r1.*sin(theta1); z=1-x-y; surf(x,y,z)
%轮胎 v=0:0.03:2*pi; u=0:0.03:2*pi; [v1,u1]=meshgrid(v,u); R=4; r=1; x=(R+r.*cos(u1)).*cos(v1); y=(R+r.*cos(u1)).*sin(v1); z=r.*sin(u1) ; surf(x,y,z) hold on quiver3(0, 0, 0,1,0,0,'g') quiver3(0, 0, 0,0,1,0,'g') quiver3(0, 0, 0,0,0,1,'g')
theta=0:0.03:2*pi;
u=0:0.03:2;
[theta1,u1]=meshgrid(theta,u);
a=4;
b=5;
c=7;
x=a.*sinh(u1).*sin(theta1);
y=b.*sinh(u1).*cos(theta1);
z=c.*cosh(u1);
mesh(x,y,z);
hold on
z=-c.*cosh(u1);
mesh(x,y,z);
grid on
axis equal
sinh->cosh 单双叶互换