Point plotting, time dependent

Hi. I quite new to this, so Ill just start asking my question.
I have a problem with plotting something.
I need to plot a point ( P(yn,yn)), to go to another point (P(x1,y2) with a vectorial speed( (vx,vy) and time (dt). Then when it has reached a point, it will start from the new one, and do it all over again.
i.e
P(x1,y1)= P(x0,y0) + V + dt V=(vx,vy) P(x2,y2)=P(x1,y1) + V + dt
The velocity could be 10 m/s and the time 0.01 s.
After the plot, Ill need a graph showing the time dependency. i.e distance and time.
Thnx
PS: I wrote a code, showing just how to move from one point to another, but is not like this i wanted it...
clc clear all close all
x = [2]; y = [1]; n=5; m=5; p1(1)=x(1); p2(1)=y(1);
for k=2:n p1(k)=p1(k-1)+10.*randn; for k=2:m p2(k)=p2(k-1)+10.*randn; end end
subplot(2,2,[1 3]) plot(p1,p2,'-d') hold on plot(x,y,'r*') subplot(2,2,2) plot(p1, p2,'-d'); subplot(2,2,4) plot(x,y,'r*'); axis equal

Answers (0)

Categories

Tags

Asked:

on 15 Feb 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!