标签:
matlab
三维图形
杂谈
分类:
MATLAB
%% a.
画椭球
a=1;b=2;c=3;
figure(1),title('
椭球
')
ellipsoid(0,0,0,a,b,c)
%
shading interp
box on;
grid off
colormap hsv
%% b.
单叶双曲面
[x,y]=meshgrid(-2:0.2:2,-2:0.2:2);
z=sqrt(c.^2*(x.^2/(a.^2)+y.^2/(b.^2)-1));
%
figure(2)
subplot(121),title('
单叶双曲面
')
surf(x,y,real(z))
hold on;
surf(x,y,-real(z))
%
[u,v]=meshgrid(linspace(0,2*pi,50),linspace(-1*pi/2,pi/2,50));
x=a.*sec(v).*cos(u);
y=a.*sec(v).*sin(u);
z=c.*tan(v);
subplot(122),title('
单叶双曲面
')
surf(x,y,z)
%
shading interp
box on;
grid off
colormap hsv
%% c.
双叶双曲面
[x,y]=meshgrid(-2:0.2:2,-2:0.2:2);
z=sqrt(c.^2*(x.^2/(a.^2)-y.^2/(b.^2)-1));
%