如題,如何用MATLAB做一個小球影片,要求已知一個函式影像(比如y=sinx)然后有一個小球沿著影像從頭到尾運動最后回傳或重復運動
uj5u.com熱心網友回復:
x=linspace(0,10,1000);y=sin(x);
plot(x,y) %先畫正弦曲線
hold on
h = plot(x(1),y(1),'o','MarkerFaceColor','red');%畫點
hold off
axis manual
j=1;
while j>0
for k=1:length(x)
h.XData=https://bbs.csdn.net/topics/x(k); %用句柄改變點的資料,是句柄影片
h.YData=https://bbs.csdn.net/topics/y(k);
drawnow
end
j=1
end
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/25954.html
標籤:語言基礎/算法/系統設計
上一篇:關于TChart的一些問題
