A Matlab program to calculate drag force against a cyclist.
A drag force is the resistance force caused by the motion of a body through a fluid, such as water or air. A drag force acts opposite to the direction of the oncoming flow velocity. This is the relative velocity between the body and the fluid.
The drag force D exerted on a body traveling though a fluid is given by
`F_d = 1/2C_dA rhov^2`
Where:
`C_d` is the drag coefficient, which can vary along with the shape of the body. But typical values range from 0.4 to 1.15 for different shapes
A is the projected cross-sectional area of the body perpendicular to the flow direction
`rho` is the density of the fluid through which the body is moving
v is the speed of the body relative to the fluid
The Matlab programme to plot the graph between velocity and drag force
%A program to plot Drag Co-efficient vs Drag force
clear all;
close all;
clc;
%input
c_d = [0.04:1.15]; % drag coefficient
A = 0.1; % Frontal Area in square meter
rho = 1.2; %Density in kg/m^3
v = 1;% Velocity in m/s
f = 0.5*c_d.*rho*A*v^2;%Drag force in N
plot(c_d,f)
%plot
xlabel('Drag coefficient')
ylabel('Drag Force(N)')
grid on
Output :-
As in the equation we can see that the drag force is proportional with the 2nd power of velocity and hence in the plot we have obtained a parabolic curve, hence the output is justified.
The drag coefficient for same projected area varies with shape, for example
Shape Drag coefficient
Streamlined body 0.04
Sphere 0.47
Short cylinder 1.15
So the matlab programme to plot Drag Co-efficient vs Drag force
%A program to plot Drag Co-efficient vs Drag force
clear all;
close all;
clc;
%input
c_d = [0.04:1.15]; % drag coefficient
A = 0.1; % Frontal Area in square meter
rho = 1.2; %Density in kg/m^3
v = 1;% Velocity in m/s
f = 0.5*c_d.*rho*A*v^2;%Drag force in N
%plot
plot(c_d,f)
xlabel('Drag coefficient')
ylabel('Drag Force(N)')
grid on
Output -
As in the equation we can see that drag coefficient varies linearly with drag force and in the output plot we have obtained a straight line hence our output is justified.