Moving point along a rectangular path
古いコメントを表示
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 件のコメント
Adam Danz
2021 年 5 月 17 日
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
2021 年 5 月 19 日
Adam Danz
2021 年 5 月 19 日
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
2021 年 5 月 19 日
Ricardo Duarte
2021 年 5 月 19 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Animation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!