本篇内容主要讲解“matlab怎么实现单个物体运动可视化生成gif”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“matlab怎么实现单个物体运动可视化生成gif”吧!function bounc
本篇内容主要讲解“matlab怎么实现单个物体运动可视化生成gif”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“matlab怎么实现单个物体运动可视化生成gif”吧!
function bouncer
[z0,h] = initialize_bouncer;
g = 9.8;
c = 0.75;
delta = 0.005;
v0 = 21;
k = 0;
while v0 >= 1
v = v0;
z = z0;
while all(z >= 0)
set(h,'zdata',z)
drawnow
v = v - delta*g;
z = z + delta*v;
k = k + 1;
frame(k)=getframe(GCf); % get the frame
pause(0.01)
end
v0 = c*v0;
end
finalize_bouncer
writegif('test.gif',frame,0.01);
end
%-----------------------------------------------
function [z,h] = initialize_bouncer
clf
shg
set(gcf,'menubar','none','numbertitle','off','name','Bouncer', ...
'color','white')
axes('position',[0 0 1 1])
[x,y,z] = sphere(20);
z = z + 1;
h = surf(x,y,z);
colORMap copper
shading interp
axis([-12.5 12.5 -12.5 12.5 0 25.0])
axis square off
view(90,0)
uicontrol('string','TOSS','style','pushbutton', ...
'units','normal','position',[.10 .05 .12 .05], ...
'background','white','fontweight','normal', ...
'enable','off','callback','bouncer')
drawnow
end
%-----------------------------------------------
function finalize_bouncer
set(findobj('string','TOSS'),'fontweight','bold','enable','on')
到此,相信大家对“matlab怎么实现单个物体运动可视化生成gif”有了更深的了解,不妨来实际操作一番吧!这里是编程网网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
--结束END--
本文标题: matlab怎么实现单个物体运动可视化生成gif
本文链接: https://lsjlt.com/news/295853.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0