ik definieer k=CdρA/(2mg) en jij definieert k=1/2CdρA
Zou dat het grote verschil voor L opleveren?
Moderator: physicalattraction
ik neem aan dat je bedoelt k=1/2CdρA ?Rik Speybrouck schreef: ↑wo 25 nov 2020, 19:48 dan kom je maar op een goeie 50 m mijn k is gewoon front opp * sg lucht* drag/(2*gewicht)
Code: Selecteer alles
# example of numerical integration of projectile motion in 2D
import matplotlib.pyplot as plt
from math import sin, cos, atan2, pi, sqrt
# constants
rho = 1.22 # density of medium
g = 9.81 # acceleration of gravity
# projectile properties
A = 0.05 # cross sectional area
Cd = 0.5 # drag factor
m = 0.1 # mass
# initial velocity & angle (radians)
v = 10. # m/s
theta = pi/4
# initial position, velocity, time
x = 0.
y = 5. # height above target surface
vx = v * cos(theta)
vy = v * sin(theta)
vx_init = vx
t = 0.
# storage for the result
X = [x]
Y = [y]
# step size
dt = 0.01
def drag(v, theta):
F =0.5*rho*v*v*A*Cd
return (F*cos(theta), F*sin(theta))
while ((y>0) | (vy>0)):
# instantaneous force:
Fx, Fy = drag(v, theta)
# acceleration:
ax = -Fx/m
ay = -Fy/m - g
# position update:
x = x + vx*dt + 0.5*ax*dt*dt
y = y + vy*dt + 0.5*ay*dt*dt
# update velocity components:
vx = vx + ax*dt
vy = vy + ay*dt
# new angle and velocity:
v = sqrt(vx*vx+vy*vy)
theta = atan2(vy,vx)
# store result for plotting:
X.append(x)
Y.append(y)
t = t + dt
# adjust last point to Y=0 - we may have "overshot":
ft = Y[-2]/(Y[-2]-Y[-1]) # fractional time to last point
X[-1] = X[-2] + (X[-1]-X[-2])*ft
Y[-1] = 0.
t = t - (1-ft)*dt
print('Total flight time: %.3f sec\n'%t)
print('Total distance: %.2f m'%X[-1])
print('Initial horizontal velocity: %.2f m/s'%vx_init)
print('Final horizontal velocity: %.2f m/s'%vx)
plt.figure()
plt.plot(X,Y)
plt.title('projectile motion')
plt.xlabel('X position')
plt.ylabel('Y position')
plt.show()