Project

Calculation for Drag Force Against a Cyclist Using Matlab

AIM:

To write a Matlab program for calculating drag force against a cyclist , for plotting Velocity vs Drag force graph and for plotting Drag Co-efficient vs Drag force graph.

GOVERNING EQUATION:

Drag Force is calculated using the following formula:-

`F_d=1/2*rho*A*V^2*C_d`

Where,

`F_d=`Drag Force

`rho=`Density of the fluid

A = Frontal Area

V = Velocity of the Vehicle

`C_d`= Drag Co-efficient

OBJECTIVE:

  1. To calculate drag force against a cyclist using Matlab Progarm.
  2. To plot Velocity vs Drag force using Matlab program.
  3. To plot Drag Co-efficient vs Drag force using Matlab Program.

MATLAB PROGRAM FOR CALCULATING DRAG FORCE:

% Program to calcuate the drag force against a cyclist


close all 
clear all
clc

% Inputs

%Drag coefficient
C_d=0.8;

% Frontal Area (m^2)
A=0.1;

% Density  (kg/m^3)
rho=1.2;

% Velocity (m/s^2)
V=[1:50];

% Drag Force(N)
F_d=0.5*A*V.^2*C_d*rho

Explanation:

  1. Here, first the commands 'close all','clear all','clc', are used to close any previous plots and to clear the workspace and command window respectively.
  2. Now ,here inputs are drag coefficent , frontal area , density of fluid and velocity of the cyclist. Input values can be taken according to the problem, i have taken value according to me.
  3. After giving the inputs , drag force formula as mentioned above is entered in the program for its calculation.
  4. Here 50 values for velocity is given as input so we will get 50 values for drag force after we run the program and since velocity is a row vector we have used elementary-wise operation, '(.*)' in the drag force formula to perform dot product.
  5. We can also give single input value for velocity or any other inputs as per our requirements, drag force will be calculated accordingly.

Result:

  1. After running the program we can see that we have got 50 values for drag force in the command window since we have given 50 values for velocity as input.
  2. In this way we can calculate drag force according to our problem.

MATLAB PROGRAM FOR PLOTTING VELOCITY VS DRAG FORCE:

% Program to calcuate the drag force against a cyclist


close all 
clear all
clc

% Inputs

%Drag coefficient
C_d=0.8;

% Frontal Area (m^2)
A=0.1;

% Density  (kg/m^3)
rho=1.2;

% Velocity (m/s^2)
V=[1:50];

% Drag Force(N)
F_d=0.5*A*V.^2.*C_d*rho;
 
% plotting Velocity vs Drag force
plot(V,F_d)
xlabel('Velocity')
ylabel('Drag force')
grid on

Explanation:

  1. In this Matlab program ,plot command is used additionally to the previous matlab program.
  2. Since plotting is to be done between velocity and drag force,plot command is used as 'plot(V,F_d)'.
  3. Here the variables inside the bracket should be same as the inputs provided,for example if 'V' is used for velocity ,in plot command also 'V' should only be used ,or else Matlab will show error.
  4. Commands like 'xlabel()' , 'ylabel()' are used to name x-axis and y-axis repectively.Here using these commands x-axis and y-axis are named as 'Velocity' and 'Drag Force'.
  5. Here 'grid on' command is also used to generate grids in the graph for better understanding and representation.
  6. Thus a graph is generated using plot command.

Result:

  1. In the below picture it can be seen how the curve is varying in the graph. As the veocity increases,drag force also increases.
  2. Aerodynamically , since drag force is directly proportional to square of velocity i.e. if velocity is increased by 2 times, drag force is increased by 4 times , so in in order to reduce drag force frontal area is reduced for high velocities.
  3. So here cyclist will experience different drag force at different velocities.

MATLAB PROGRAM FOR PLOTTING DRAG CO-EFFICIENT VS DRAG FORCE:

% Program to calcuate the drag force against a cyclist


close all 
clear all
clc

% Inputs

%Drag coefficient
%for Sphere=0.47,Cube=1.05,Short Cylinder=1.15,Streamlined body=0.04
C_d=[0.47 1.05 1.15 0.04];

% Frontal Area (m^2)
A=0.1;

% Density  (kg/m^3)
rho=1.2;

% Velocity (m/s^2)
V=10;

% Drag Force(N)
F_d=0.5*A*V^2*C_d.*rho
 
% plotting Drag Co-efficient vs Drag force
plot(C_d,F_d)
xlabel('Drag Co-efficient')
ylabel('Drag force')
grid on

Explanation:

  1. For the same frontal area, the coefficient of drag varies for different shapes.
  2. So four Drag co-efficients of four different shapes,they are sphere, cube, short cyclinder and streamlined body are used in this program.
  3. Now for same velocity ,we have considered 4 different drag coefficients, therefore we will get four different values for drag force .
  4. Since here drag co-efficient is row vector, elementary-wise operation (.*) is used for drag co-efficient in drag force formula in the program.
  5. After running the program ,we will get four different drag forces corresponding to four different drag co-efficients.
  6. Now to plot the graph between drag co-efficient and drag force 'plot()' command is used and to name x-axis and y-axis, 'xlabel()' and 'ylabel()' commmands are used respectively. 'Grid on' command is used to on the grids in the graph.

Result:

  1. Here we have got four different values of drag force in command window after running the program.
  2. In the graph below, we can observe that shapes with small drag co-efficients have less drag force at same velocity.
  3. So as the drag co-efficient increases, drag force also increases.
  4. So here if the cyclist has different drag co-efficients by moving his body, drag force on him will change respectively.

CONCLUSIONS:

  1. Using this program we can calculate drag force on any moving object.
  2. FOR LOOP can be used if number of inputs are more. If there are ten drag co-efficients and ten velocities, and if we have to calculate for each velocity what is the drag force for each drag coefficient, we can use FOR LOOP instead of manually typing each value.
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.