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.

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Networks 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by