源代码
clc;clear;close all
m=0:.05:1;
[R,T]=ndgrid(m,0:.01:20);
x=1-abs(1-mod(7.6*T,2))/2;
P=pi*exp(-T/8)/2;
s=@sin;
c=@cos;
u=s(P);
v=c(P);
w=R.*u;
y=w.*(1.4*R-1).^2;
g=@(f)x.*(w+y.*v).*f(T*pi);
X=g(s);
Y=g(c);
Z=R.*v-y.*u;
surf(X,Y,x.*Z/2,hypot(hypot(X,Y),Z),'EdgeColor','n');
axis equal off
colormap([m/2+.5;m;m/2+.5]')
set(gcf,'Color','w')
程序仿真结果