#Program to calculate the drag force
import matplotlib.pyplot as plt
#Inputs
# Drag co efficient
c_d = 0.8
# Frontal Area(m^2)
A = 0.1
# Density (kg/m^3)
rho = 1.2
# Bicycle velocity
velocities = range(1,25,1)
drag_forces1 = []
drag_forces2 = []
for velocity in velocities:
drag_forces1.append((0.5*rho*A*c_d*velocity*velocity))
# print(drag_forces)
plt.plot(velocities,drag_forces1)
plt.xlabel(\'velocity\')
plt.ylabel(\'Drag force\')
plt.show()
# C_d values for different shapes
# Flat plate = 1.28
# Sphere = 0.07 to 0.5
# Prism = 1.14
# Airfoil = 0.045
CDS = [0.1,0.2,0.3,0.4,0.5,0.6]
v = 0.3
for CD in CDS:
drag_forces2.append(0.5*rho*A*CD*v*v)
plt.plot(CDS,drag_forces2)
plt.xlabel(\'drag coefficient\')
plt.ylabel(\'Drag force\')
plt.show()