Drag force with plot
Drag force relation with the velocity was plotted using an array of velocities pre-determined.
# Drag Force_using array for v
# program to calculate the drage force
import matplotlib.pyplot as plt
# plt.switch_backend("TkAgg")
#inputs
c_d = 0.8 # Drag coefficient
A = 0.1 # frontal Area
rho = 1.2 # density
v = [5,6,7,8,9,10,11,12] # bicycle velocity array
drag_force = []
#Drag force calculation
for velocity in v :
print(0.5*rho*c_d*velocity*velocity*A)
for velocity in v :
drag_force.append(0.5*rho*c_d*velocity*velocity*A) # append keeps on adding the value in the array in the last of the array
print(drag_force)
plt.plot(v,drag_force)
plt.xlabel ('Velocity')
plt.ylabel ('Drag Force')
plt.show()