Matlab program for Drag Force calculations of flow over bicycle
%% Program to calculate drag force over bicycle
clc
clear all
close all
%% PART 1 :- Calculating drag force and plotting using a user defined function
% 1.) If using Matlab 2017 and ahead, the file can be runned directly.
% 2.) If using Matlab 2016 or before, please cut and copy the function at the end of program in
% another file and save it with name Drag_force1.m
% Inputs
c_d = 0.8; % Drag coeffiecient
A = 0.1; % Frontal area (m^2)
rho = 1.2; % Density of air (kg/m^3)
v =[1:50]; % Velocity of bicycle (m/s)
DF1 = Drag_force1(c_d,rho,A,v); % A function named Drag_force1 calculating and plotting the drag force vs velocity
%% PART 2 :- Document the drag coefficient for various shapes and try to plot drag force as a function of drag coeffiecient
%{
Drag coefficients for various shapers
1. Sphere = 0.47
2. Half-sphere = 0.42
3. Cone = 0.50
4. Cube = 1.05
5. Angled cube = 0.80
6. Long Cylinder = 0.82
7. Short Cylinder = 1.15
8. Streamlined body = 0.04
9. Streamlined half body = 0.09
Source :- Wikipedia/Drag_coefficient
%}
cd1 = [.47 .42 .50 1.05 .80 .82 1.15 .04 .09]; % Cd for various shapes
figure(2)
v1 = 10; % velocity assumed for comparision (m/s)
DragForce = 0.5*cd1*rho*A*v1.^2;
scatter(cd1,DragForce)
title('Plotting Drag Force vs Drag coefficient')
xlabel('Cd');
ylabel('Drag Force (N)');
grid on;
grid minor;
%% Function for PART 1
Cut and copy this part in new file if using Matlab 2016 or before and save as
Drag_force1.m
function [DragForce] = Drag_force1(cd,rho,A,v)
%DRAG FORCE
%cd - drag coefficient;
%rho - density;
%A - frontal area;
%v - velocity
DragForce = 0.5*cd*rho*A*v.^2;
plot(v,DragForce)
title('Plotting Drag Force vs Velocity using function')
xlabel('Velocity (m/s)');
ylabel('Drag Force (N)');
grid minor;
end
__________________________________________________________________________
Conclusion :
1) On increasing the velocity, the drag force is increased in quadratic sense.
2) Increasing coefficient of drag results in drag force is increased linearly.