Borrar filtros
Borrar filtros

Help for plotting a moving object

13 visualizaciones (últimos 30 días)
Son
Son el 27 de Mayo de 2013
Comentada: Walter Roberson el 18 de Nov. de 2021
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 comentario
wael ali
wael ali el 10 de Dic. de 2015
hi every one, how can I model a moving train scenario that move linearly from point 1 to point 2

Iniciar sesión para comentar.

Respuestas (2)

Happy61
Happy61 el 28 de Mayo de 2013
Editada: Happy61 el 31 de Mayo de 2013
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 comentarios
reena raj
reena raj el 18 de Nov. de 2021
please sent all the code
Walter Roberson
Walter Roberson el 18 de Nov. de 2021
Please post your attempt along with the error message you are getting.

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 18 de En. de 2018
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.

Categorías

Más información sobre Specifying Target for Graphics Output en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by