How do i create a projectile?

5 ビュー (過去 30 日間)
Adriana Diaz
Adriana Diaz 2019 年 11 月 26 日
回答済み: Jim Riggs 2019 年 11 月 27 日
Provided the properties of an object and initial conditions, simulate the path the object will follow as a projectile, including air resistance. Note that for air resistance you may use a simplified drag equation: Drag Force = Drag Coefficient x Velocity2
Input: initial x,y position and velocity, object mass and drag coefficient, gravitational acceleration Built in Logic: Check whether the object is has hit the ground (y=0) and terminate the simulation if so (use the break function) Animation Plot: Object position in time Summary Plot: Your choice of one variable Output: Distance travelled, and your choice of at least one other variable
  2 件のコメント
James Tursa
James Tursa 2019 年 11 月 26 日
What have you done so far? What specific problems are you having with your code?
Adriana Diaz
Adriana Diaz 2019 年 11 月 26 日
I need help starting it.

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

回答 (2 件)

Philippe Lebel
Philippe Lebel 2019 年 11 月 26 日
編集済み: Philippe Lebel 2019 年 11 月 26 日
as example for a non-accelerating projectile (which is not your case) this could look like
time = 0:1:100; % time goes from 0 to 100 seconds for example
initial_position = [0,0]; % [x,y]
initial_velocities = [10,5];
position_x = initial_velocities(1)*t + initial_position(1);
position_y = initial_velocities(2)*t + initial_position(2);
the drag force provides an acceleration against the direction of movement (in x AND y) you will need to use cinematics equations such as:
x(t) = 0.5*acceleration_x * t^2 + inti_vel_x * t + init_pos_x;
and forces equations such as:
acceleration = Forces/mass
i hope this hint will get you going.

Jim Riggs
Jim Riggs 2019 年 11 月 27 日
Always start by making a drawing of the problem.
  • Define the coordinate system (which way is positive/negative)
  • What are the parts of the system and their interconnections/relationships (topology)
  • Define variable quantities and names
For Kinetic/kinematic analysis, draw a free-body diagram of the system
  • Label forces, displacements, angles, velocity vectors, acceleration vectors
  • Check sign conventions on all parameters
Using your drawings, define mathematical relationships using the nomenclature and sign conventions from your drawing.
For a trajectory model, you will define the initial condition, then integrate the equations of motion over some period of time (i.e. a loop in the program), until some condition is reached (vertical position goes below the ground or time limit is reached - you need a mathematical expression for this condition). Use this condition to exit the loop.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by