Project

MATLAB Program: Flow Over Bicycle

Aim: Write a MATLAB program to calculate drag force against a cyclist

Objectives:

  • Calculate drag force
  • Plot Velocity vs Drag Force
  • Plot Coefficient of Drag Force vs Drag Force

Theory:

We know that we are submerged in a fluid called air. When a submerged body undergoes motion, it experiences a resistive force. This resisitive force has two components:

Drag Force (Fd): The component of resistive force in the direction of motion.

Lift Force (Fl): The component of resistive force perpendicular to direction of motion. It only occurs when axis of the body is inclined.

Thus, in case of bicycles the lift force is negligible, hence we cannot see a flying bicycle!There is a considerable drag force which is accounted by the bicycle frame as well as the rider's body. Different riding positions affects the resulting drag force.

The drag force depends on the following factors:

  1. The shape of body (it effects coefficient of drag)
  2. The fluid medium (force depends on density)
  3. Velocity of body (precisely relative velocity of the body and fluid)

The expression for drag force is given as:

`Fd = 1/2rhoAV^2Cundersetd`

where,

Fd = Drag force

ρ = Density of fluid

A = Frontal Area

V = Velocity of object

Cd = Coefficient of Drag

Frontal Area: The complete area of a body isn't affected rather the projected area is. The projection of body on the direction of motion is the frontal area. This area experiences drag.

Coeffeicient of drag: It is a dimensionless quantity which is used to quantify drag of an object in fluid environment. It's value depends on shape of object.

Program:

The theory when blended with logics of programming gives the following result. It is a MATLAB program.

%Flow over a bicycle
clear all
close all
clc

%Inputs

%Frontal Area (m^2)
A = [0.374 0.370 0.339 0.423 0.460];
%Coefficient of drag (dimensionless)
C = [0.626 0.638 0.655 0.655 0.670];
%Velocity (m/s)
V = linspace(1,20,5);
%Density of fluid (air in kg/m^3)
d = 1.225;

%elementwise multiplication of area and coefficient
Z = A.*C;

%Velocity VS Drag Force Plot
for i = 1:5
  F = 0.5 * d * Z(i) .* (V.^2);
  hold on
  plot(V,F)
  grid on
  title('Velocity VS Drag Force Plot')
  xlabel('Velocity (m/s)')
  ylabel('Drag Force (N)')
  %AC in legend denotes area and coefficient combo; which is stored in Z 
  legend("AC-1","AC-2","AC-3","AC-4","AC-5")
  %The above syntax shows error in command line until final iteration as intially the program thinks that the legends are useless
end
%Drag coefficient VS Drag force
figure(2)
plot(C,F)
grid on
title('Coefficient of Drag VS Drag Force Plot')
xlabel('Coefficient of drag')
ylabel('Drag Force (N)')

%This code met its objectives

Working of Code:

The above code has frontal area and their respective coefficient of drag in matrix form. They are multiplied elementwise so that these variables are multiplied to their corresponding values. A velocity vector is multiplied to the result (operations as per formula) to give drag force. Velocity and drag force are plottted and vaiuos cases are ploted on same graph. As there are five cases, velocity vector needs to be multplied five times, this is facilitated by for loop. Further, the coefficient of drag and drag force is plotted. This completes our objective.

Output:

Figure-1: Workspace and figure output

Figure-2: Velocity vs Drag Force

Figure-3: Coefficient of drag vs Drag Force

Conclusions:

The above plots shows that velocity and drag force have a parabolic relation whereas coefficient of drag and drag force has linear relation. Coefficient of drag doesn't remain constant and drag depends on frontal area and not the total surface area.

References:

Material: Code and Plots can be accessed here

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.