Help for plotting a moving object

Dear all,
I am doing a project about multi-lanes highway simulation, and to get starting, I am looking for some literatures to guide me how to draw/plot moving objects, like cars, in Matlab or does someone have the code ? Please help me ! Thanks a lot

댓글 수: 1

wael ali
wael ali 2015년 12월 10일
hi every one, how can I model a moving train scenario that move linearly from point 1 to point 2

댓글을 달려면 로그인하십시오.

답변 (2개)

Happy61
Happy61 2013년 5월 28일
편집: Happy61 2013년 5월 31일

1 개 추천

It may sound complicated but it's really easy to draw/plot moving object in MATLAB.
h=[];
for j=1:TimeSteps
delete(h)
h=plot (x.position(1,j), y.position(1,j))
drawnow;
end
TimeSteps: being duration of the simulation, x, y are the x and y position of your vehicle for each timestep.
I have experience building traffic simulator in MATLAB, so if you have any more questions don't hesitate to ask.

댓글 수: 12

Son
Son 2013년 5월 28일
thank you very much, may I have your email address ???
Happy61
Happy61 2013년 5월 31일
Hi, You are very welcome! I tried sending you my email through private message but it didn't work. :( Maybe you can send me your email address or you can just ask me any questions you have here. Cheers.
Image Analyst
Image Analyst 2013년 5월 31일
And what is the point of "h"? You probably want h=plot(.....
Happy61
Happy61 2013년 5월 31일
oh yea..I forgot to type the "h"...thanks!
ranjani raja
ranjani raja 2016년 9월 20일
편집: ranjani raja 2016년 9월 20일
Hi,In the above code where should I add my video from which I have to plot the movement of the car?
parismita bhuyan
parismita bhuyan 2018년 1월 18일
how to move the vehicles in a specific direction with speed
Walter Roberson
Walter Roberson 2018년 1월 18일
"how to move the vehicles in a specific direction with speed"
Given a direction as an angle, and given a speed, you can use pol2cart to convert the angle and speed to x and y offsets. You would add those offsets to the coordinates of your objects at each step and update the coordinates in the plot.
reena raj
reena raj 2021년 11월 17일
itisnot working
Walter Roberson
Walter Roberson 2021년 11월 17일
reena raj
reena raj 2021년 11월 18일
please sent all the code
Walter Roberson
Walter Roberson 2021년 11월 18일
Please post your attempt along with the error message you are getting.

댓글을 달려면 로그인하십시오.

Walter Roberson
Walter Roberson 2018년 1월 18일

0 개 추천

You should consider creating one hgtransform for each object to be drawn, and then set the Parent of the object to be drawn to be the hgtransform. Then when you need to move or rotate the object, change the transform matrix of the hgtransform; you might find hgmaketform() handy for that.

카테고리

도움말 센터File Exchange에서 Animation에 대해 자세히 알아보기

질문:

Son
2013년 5월 27일

댓글:

2021년 11월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by