Matlab program to calculate drag force against a cyclist
In this program, at first drag force is calculated and plotted against velocity,keeping all other parameters constant.
In the second part, the drag coefficient for various shapes was documented and drag-force was caluculated as a function of drag coefficient keeping all other parameters constant.
% Program to calculate drag force acting on a cyclist
clear all
close all
clc
% Incorporate a function to plot Drag force vs Velocity
% drag co-efficient
c_d1 = 0.3;
% frontal area (m^2)
a1 = 1.5;
% density (kg/m^3)
rho1 = 1.2;
% velocity (m/s)
v1 = linspace(1,100,15);
drag_force2 = 0.5*c_d1*rho1*a1*(v1.*v1);
figure(1);
plot(v1,drag_force2);
xlabel(\'Velocity\');
ylabel(\'Drag Force\');
grid on;
% To document the drag coefficient for various shapes and plot drag force as a function of drag coeffiecient
% frontal area (m^2)
a2 = 1.8;
% density (kg/m^3)
rho2 = 1.2;
% velocity (m/s)
v2 = 5;
% drag co-efficient (sphere,half-sphere,cone,cube,angled cube,long cylinder,short cylinder,streamlined body,streamlined halfbody in order)
c_d2 = [0.47 0.42 0.50 1.05 0.8 0.82 1.15 0.04 0.09];
drag_force2 = 0.5*c_d2*rho2*a2*(v2.*v2);
figure(2);
plot(c_d2,drag_force2);
xlabel(\'Drag Co-efficient\');
ylabel(\'Drag Force\');
grid on;