plotting sine graphs by moving dots

Hi! I want plot two sine graphs
like this .
v=1; %1m per sec
dt=0.01;
x=0;
y=0;
xr=-2.7;
yr=0;
theta=0;
sta_rad=deg2rad(sta); %deg->radian
for i=1:1:length(sta)
sta_cmd(i)=sta_rad(i)-theta(i); %steering angle command
%theta 개입 없이 sta_rad만 sin,cos에 관여
%front wheel
x(i+1)= x(i)+v*cos(theta(i)+sta_cmd(i))*dt;
y(i+1)= y(i)+v*sin(theta(i)+sta_cmd(i))*dt;
%rear wheel: no delata
xr(i+1)=xr(i)+v*cos(theta(i))*dt;
yr(i+1)=yr(i)+v*sin(theta(i))*dt;
theta(i+1)=theta(i)+(v*tan(sta_cmd(i)))/L*dt %theta
end
figure();hold on;
plot(x,y,'r');
plot(xr,yr,'b');
legend('front wheel','rear wheel');
How do i draw this graph by moving two dots?
I want each of the dots draw each of the lines or each of the dots move through each lines.

2 comentarios

David Goodmanson
David Goodmanson el 21 de Mayo de 2020
Hi eunna,
take a look at the comet command
eunna shin
eunna shin el 22 de Mayo de 2020
thanks! I'll try :)

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Networks en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 21 de Mayo de 2020

Comentada:

el 22 de Mayo de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by