您好,登錄后才能下訂單哦!
本篇內容主要講解“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”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。