- #1

nobodyhere

- 2

- 0

- Homework Statement
- Im a little stuck here.

I need to make a plot that shows the trajectory in the x,y plane of an object of mass m launched at an angle of 𝜃. The equation of motion of the projectile with atmospheric drag (at low enough speeds that no turbulence is created) is:

m(dv/dt)=−mgy−cv

where v(t)=(vx(t),vy(t)) is the projectile velocity at time t. The constant c characterizes the atmospheric friction. (As an aside, if the motion of the projectile is fast enough that turbulence is created, the friction term changes to −bv^2). We will integrate the equation of motion numerically in this project. However, in this case, an analytic solution is possible. If we call r(t)=(x(t),y(t)) the position of the projectile at time t, the equation of motion can be integrated to give:

x(t)=(v0vT)/g*(1−e^(gt/vT))cos(θx(t))

y(t)=vT*g(vT+v0sin(θ))(1−e^(gt/vT))−vTt

where vT=(mg)/c is the terminal velocity, and v0 is the initial speed.

I need to implement a numerical solution of the differential equation with odeint() and compare the trajectory you find to the analytic solution above.

Use the following parameters and initial conditions:

𝑐 = 0.65 kg/s,

𝑔 = 9.81 m/s2,

𝑚 = 0.1 kg,

𝑣0 = 10 m/s,

𝜃 = 50 above the horizontal,

The questions you need to consider are:

What is the distance 𝑑 to impact?

What is the maximum height, ℎ, reached?

What is the time of flight, 𝑇?

What is the velocity, 𝑣 at the impact point

So far I have the following but I don't know what to put for dx/dt, dy/dt, dv/dt

- Relevant Equations
- m(dv/dt)=−mgy−cv

x(t)=(v0vT)/g*(1−e^(gt/vT))cos(θx(t))

y(t)=vT*g(vT+v0sin(θ))(1−e^(gt/vT))−vTt

Python:

```
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
c=0.65
g=9.81 # gravitational force on earth
angle=50 # angle at which projectile is launched
m=0.1
#returning dx/dt, dy/dt, dv/dt as an array
def model(yaf,t):
x=yaf[0] # x position is first element of yaf
y=yaf[1] # y position is second element of yaf
v=yaf[2] # velocity is third element of yaf
return np.array([dx/dt, dy/dt, dv/dt])
t0=0 # initial condition for time
tmax=20 # max time
steps=20 # numer of steps
# time points
t = np.linspace(0,tmax, steps)
#initial conditions for x position, y position and velocity
initial=[0,0,10]
# solve ODE
y = odeint(model,initial,t)
print(y)
# plot results
plt.plot(t,y)
plt.show()
```

Last edited: