构造旋转体
% 构造旋转体% 圆柱
subplot(221);
t=ones(1,40)*5;
=cylinder(t);
c=ones(size(z));
surf(x,y,z,c)
shading faceted
title('圆柱')
axis off
% 圆锥
subplot(222);
t=0:.1:2;
=cylinder(fliplr(t));
c=ones(size(z));
surf(x,y,z,c)
shading faceted
title('圆椎')
axis off
% 椭球
subplot(223)
t=linspace(0,pi,100);
=cylinder(sin(t)/4);
c=ones(size(z));
mesh(x,y,z,c)
shading faceted
title('椭球')
set(gca,'position',)
axis off
% 一般旋转体
subplot(224)
t=linspace(0,pi,100);
=cylinder(2+cos(t).^2);
c=ones(size(z));
mesh(x,y,z,c)
shading faceted
title('一般旋转体')
set(gca,'position',)
axis off
抖动的蜂窝
t=;tr=randn(size(t));
r=cos(t).*cos(t*6)+cos(t*9).*cos(tr*9);
x=r.*cos(t+pi/2);
y=r.*sin(t+pi/2);
H=plot(x,y);
k=1;
xlabel('Please press "space" key and stop this program!',...
'fontsize',12,'color','r');
set(gcf,'doublebuffer','on');
d=0;
while k
s=get(gcf,'currentkey');
if strcmp(s,'space');
clc;k=0;
end
t=t+cos(d+1)*10;
r=0.2*sin(t)+sin(3*t).*sin(5*t)+1.9*sin(7*t).*sin(9*t);
x=r.*cos(t);
y=r.*sin(t);
set(H,'xdata',x,'ydata',y);
pause(0.1);
end
figure(gcf);
{:3_52:} 顶一下,最好再能做个动画的 yanhaoguo 发表于 2010-10-26 16:17 static/image/common/back.gif
顶一下,最好再能做个动画的
参考论坛动画的相关程序修改就能够实现相关的旋转动画效果 回复 happy 的帖子
好,有时间去学习下 yanhaoguo 发表于 2010-10-27 10:05 static/image/common/back.gif
回复 happy 的帖子
好,有时间去学习下
改出来后分享一下,{:{02}:} 献上旋绕动画一个:曲线xy=1绕z轴旋转一周
figure;
view(3);
axis([-3,3,-3,3,0,3]);
axis off
hold all;
plot3(,,[-3,3],'k')
plot3([-3,3],,,'k')
plot3(,[-3,3],,'k')
ax=;
fill3(ax(1,:),ax(2,:),ax(3,:),'k')
ax=;
fill3(ax(1,:),ax(2,:),ax(3,:),'k')
ax=;
fill3(ax(1,:),ax(2,:),ax(3,:),'k')%绘制坐标系
t=1/2:.001:2;
for theta=0:pi/100:2*pi
z=t;x=sin(theta)*1./t;y=cos(theta)*1./t;
line(x,y,z,'color',rand(1,3));
pause(.005)
end
通过效果图可以看出,line绘制的是曲线图,而mesh绘制的才是曲面图,
不知有没有高手可以奉献一个曲面的动画?或者是mesh就不能产生这种类型的动画?
页:
[1]