Moving point along a rectangular path
Ältere Kommentare anzeigen
Dear all,
I would like create a point that moves along a path (as in the figure) knowing only the initial and the final position of that point.

After that I would like to plot that movement in a figure.
Thanks in advance for your help.
Best wishes
6 Kommentare
Adam Danz
am 17 Mai 2021
What have you tried so far?
What ideas do you have to conceptually address this?
For example, if you know the starting and end coordinate, you don't the height and width of the outer rectangle.
Let's say it should take 4 direction reversals as shown in your image. How would you compute the width of each reversal? (hint: outer rectangle size divided by number of reversals).
What would be the next step to solve?
Ricardo Duarte
am 19 Mai 2021
Adam Danz
am 19 Mai 2021
Good start.
The code breaks on the first iteration of the i-loop at this line
xlim([x1-1 x2+1]); ylim([y1-1 y3+1]);
Error using xlim (line 31)
Limits must be a 2-element vector of increasing numeric values.
Error in **** (line 228)
xlim([x1-1 x2+1]); ylim([y1-1 y3+1]);
which makes sense since [x1-1 x2+1] is [-991 -1009].
Tell me more about the goal. Is the problem that the velocity of the ball is not constant? Is the problem that you'd like to define a specific velocity? If so, we'll need a lot more information about the specifics.
Ricardo Duarte
am 19 Mai 2021
Ricardo Duarte
am 19 Mai 2021
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Animation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!