A moving point along a graph.
136 ビュー (過去 30 日間)
Hello everyone, i succesfully plotted a graph that looks like this. figure 1- Graph
Right now, i want to make a point move along the graph. I need some help with that, is there a simple way of making a point move along the plot?
Any help, suggestions or advice will be heavily appreaciated :D
回答 (2 件)
J. Webster 2016 年 4 月 27 日
編集済み: J. Webster 2016 年 4 月 27 日
You put the plot inside of a loop and update the position of the point each time...
x = 0:.01:6;
y = sin(x);
px = 0;
py = 0;
figure(100); %This is so it will replot over the previous figure, and not make a new one.
plot(x,y, px, py,'o');
px = px+6/100;
py = sin(px);