Wall Ball bounce Physics

1 回表示 (過去 30 日間)
gracias claude
gracias claude 2021 年 1 月 31 日
コメント済み: Walter Roberson 2021 年 1 月 31 日
Motion of the ballI nitial position:
x0=0,
y0=0.
Constant Velocity: Vx= Vcosθ and Vy= Vsinθ where V and θare user inputs
.Position as function of time:x(t) = x0+ Vxty(t) = y0+ VytIn an iterative calculation:
x(t+Δt) = x(t) + VxΔt
y(t+Δt) = y(t) + VyΔt
Collision DetectionSince the box is bounded by x=10, y=10, x=-10, and y=-10, a ball will be colliding with one of the walls when x(t)≥10, x(t)≤-10, y(t)≥10, or y(t)≤-10. When a collision occurs, the ball will be bouncing off the wall.(Make sure the red dot will not go outside the box.)
  7 件のコメント
gracias claude
gracias claude 2021 年 1 月 31 日
should I do this in a for or while loop ?
Walter Roberson
Walter Roberson 2021 年 1 月 31 日
What is your stopping condition?
If you are required to do a particular number of time steps then use for
If you are required to stop when a condition is reached (e.g., 20 bounces), then use a while loop.
If you are required to go indefinitely until the user interrupts with control-C then use a while loop.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangePhysics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by