Flow over Bicycle using MATLAB
AIM : To create a Matlab program to calculate drag force against a cyclist.
Objectives :
- Create a code to calculate drag force against a cyclist.
- Plot the graph for Velocity vs Drag force.
- Plot the graph for Drag Co-efficient vs Drag force.
CODE :
%% Flow over a bicycle for calculating Drag force for plotting Velocity and Drag force
clear all
close all
clc
% Density (kg/m^3)
rho = 1.2
% Frontal Area (m^2)
A = 0.1
% Velocity (m/s)
v = [1:25]
% Drag Coefficient (Unit less)
C_d = 0.8
% Drag Force
Drag_force = 0.5*rho*A*v.^2*C_d
plot(v , Drag_force , 'g')
xlabel('Velocity')
ylabel('Drag force')
grid on
%% Flow over a bicycle for calculating Drag force and plotting Drag cofficient vs Drag force
clear all
close all
clc
% Density (kg/m^3)
rho = 1.2
% Frontal Area (m^2)
A = 0.1
% Velocity (m/s)
v = 15
% Drag Coefficient (Unit less) for different shapes
streamlined_body = 0.04;
cone = 0.50;
short_cylinder = 1.15;
half_sphere = 0.42;
sphere = 0.47;
C_d = [streamlined_body half_sphere sphere cone short_cylinder]
% Drag Force
Drag_force = 0.5*rho*A*v^2*C_d
plot(C_d, Drag_force , 'r')
xlabel('Drag coefficient of various shapes')
ylabel('Drag force')
grid on
STEPWISE EXPLANATION OF THE CODE :
- Start with the general commands clear all, close all and clc which will clear the window and close all the recents plots if any exists.
- Assign the input values for Velocity,Drag coefficient,Frontal Area,Density of air.
- Use the plot command to plot velocity on x axis & drag force on y axis and label it.
- Now, for calculation of drag force and results give the values of drag coefficient for different shapes and calculate drag force by using formula.
- Plot the graph for drag coefficient against the drag force using plot command and label for X & Y axis respectively.
RESULTS :
- Here, the plot shows the curve for velocity vs Drag force when the velocity increases so does the drag force also increases with it for the same Frontal area.
- Here, is the plot for 2nd program. The output tells us that for different drag coefficients for various shapes the drag force changes with respect to it. As, the Drag coefficient(C_d) increases for different shapes so thus, the Drag force also increases with it linearly.
1st program Output for Velocity vs Drag force
- Here, the velocity increases from 1 m/s to 25 m/s so thus, the Drag force inreases with it from 0.0480 to 30 N respectively.
2nd program Output for Drag Coefficient vs Drag force
- Here, the drag coefficient increases for different shapes from 0.04 to 1.1500, correspondingly the drag force also increases with it from value 0.5400 to 15.5250 respectively.
Conclusion -
Hence, we had sucessfully created a code and calculated the drag force over the cyclist and obtained its output plots respectively.