Project

Calculating drag force experienced by cyclist and plotting using PYTHON Programming.

OBJECTIVE:

In this challenge, we will calculate drag force experienced by cyclist and plot these values against velocity and drag coefficient.

PROGRAMMMING EXPLAINED:

  1. Imported Matplotlib which is data visualization library for python.
  2. Defined INPUTS. For first plot coefficient of drag, frontal area and density of air are fixed values. Here to get different Drag forces, we varied velocity by creating an array consisting of 10 values by using linspace.
  3. We used FOR loop to assign different values of velocity and then calculated drag force by formula .

4. To store the values of drag forces an empty array was defined and append was used to assign the values of drag force into this array.

5. To plot the values PLOT function was used and to get graph SHOW function was used.

6. We also used x label and y label to show drag force and velocity on plot.

# To calculate drag force experinced by cyclist against the wind and plot variation of drag force with velocity and drag coefficient.
#Luv Kumar

import matplotlib.pyplot as plt
import numpy
#INPUTS
#drag coefficient (dimensionless constant)
cd = 0.8
#Frontal Area(m*m)
a = 0.1
#Density(kg/m*m*m*) (Density of fluid that object is resisting)
rho = 1.2
#Velocity of bike( m/s)
v = numpy.linspace(5,25,10)
#Drag force (kg-m\s*s)
d = []
for velocity in v:
	d.append((0.5*cd*rho*a*velocity*velocity))
	
plt.figure()
plt.plot(v,d)
plt.xlabel('velocity')
plt.ylabel('drag force')
plt.title('Drag force vs velocity plot')



c = [0.47,0.42,0.50,1.05,0.80,0.82,1.15,0.04,0.09]
vel = 50
dragforce = []
for dragcoefficient in c:
	dragforce.append((0.5*dragcoefficient*rho*a*vel*vel))



plt.figure()
plt.title('drag force vs coefficient of drag')
plt.xlabel('coefficient of drag')
plt.ylabel('drag force')

plt.plot(c,dragforce)
plt.show()

7. For second plot, velocity, area and rho was fixed and coefficient of drag was varied to calculate different drag forces.

8. Drag force was stored in an array using append.

9. Plotting was done.

CONCLUSION:

  1. From plot we can see that, drag force and velocity does not vary linearly.
  2. Also we can see, drag force varies linearly with drag coefficient.
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.