plotting sine graphs by moving dots
Show older comments
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 Comments
David Goodmanson
on 21 May 2020
Hi eunna,
take a look at the comet command
eunna shin
on 22 May 2020
Answers (0)
Categories
Find more on Networks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!