exm110633_1.m
来自「MATLAB 6.5 从基础讲解其功能」· M 代码 · 共 20 行
M
20 行
function exm110633_1
shg;R0=1;
a=12*R0;b=9*R0;T0=2*pi;
T=5*T0;dt=pi/100;t=[0:dt:T]';
f=sqrt(a^2-b^2);
th=12.5*pi/180;
E=exp(-t/20);
x=E.*(a*cos(t)-f);y=E.*(b*cos(th)*sin(t));z=E.*(b*sin(th)*sin(t));
plot3(x,y,z,'g')
[X,Y,Z]=sphere(30);X=R0*X;Y=R0*Y;Z=R0*Z;
grid on,hold on,surf(X,Y,Z),shading interp
x1=-18*R0;x2=6*R0;y1=-12*R0;y2=12*R0;z1=-6*R0;z2=6*R0;
axis([x1 x2 y1 y2 z1 z2])
view([117 37]),
p=input('Please input the comet'' length coeffient (the default value is 0.1): ');
if ~isempty(p),
p=0.1;
end
comet3(x,y,z,p),hold off
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?