Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- def dist( angle,m_prop ):
- t=np.linspace(0,10,1001)
- vx=np.zeros((1001,))
- vy=np.zeros((1001,))
- x=np.zeros((1001,))
- y=np.zeros((1001,))
- m=90
- radians=np.radians(angle)
- A=0.8
- g=-9.8
- mass=65
- rho=1.225
- C=1.4
- initial_height=5
- initial_velocity=1500*(m_prop/mass)**0.45
- y[0]=initial_height
- vx[0]=initial_velocity*np.cos(radians)
- vy[0]=initial_velocity*np.sin(radians)
- for j in range(1,1001):
- if y[j-1] <= 0:
- vx[j] = 0
- vy[j] = 0
- y[j] = 0
- x[j] = x[j-1]
- else:
- v = np.sqrt( vx[ j-1 ]**2 + vy[ j-1 ]**2 )
- ax = -( 0.5*rho*C*A/mass ) * v**2 * ( vx[ j-1 ] / v )
- ay = g-( 0.5*rho*C*A/mass ) * v**2 * ( vy[ j-1 ] / v )
- vx[j]=vx[j-1]+ax*(t[j]-t[j-1])
- vy[j]=vy[j-1]+ay*(t[j]-t[j-1])
- x[j]=x[j-1]+vx[j]*(t[j]-t[j-1])
- y[j]=y[j-1]+vy[j]*(t[j]-t[j-1])
- if y[j]<=0:
- vx[j]=0
- vy[j]=0
- y[j]=0
- x[j]=x[j-1]
- return x[-1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement