Calculate the drag force on the bicycle using MATLAB. Also, plot the graph.
AIM:
Write a program to calculate the drag force on the bicycle using MATLAB.
Also, plot the graph for the following :
- Velocity v/s Drag Force
- Drag coefficient v/s Drag Force
EQUATION/FORMULA USED:
`F_D = 1/2rhoAv^2C_D`
Where,
FD = Drag Force
CD = Drag Coefficient
A = Frontal Area
`rho`= Density of Air
V = Velocity
OBJECTIVE:
The main objective is to increase the efficiency of the cyclist.
BODY:
CODE
% To calculate the drag force on a bicycle using matlab
clear all
close all
clc
% inputs
% velocity m/s
v = linspace(10, 45, 7);
% values of drag coefficient for various shape
%airfoil
cd_airfoil = 0.045;
%bullet
cd_bullet = 0.295;
%sphere
cd_sphere = 0.47;
%cone
cd_cone = 0.50;
%cube
cd_cube = 1.05;
%prism
cd_prism = 1.14;
% flat plate
cd_flat_plate = 1.28;
%drag coefficient
c_d = [cd_airfoil cd_bullet cd_sphere cd_cone cd_cube cd_prism cd_flat_plate];
% frontal area m^2
A = 0.36;
% density of air kg/m^3
rho = 1.225;
% drag force kgm/s^2
f_d = 0.5*rho*A*v.^2.*c_d
% plotting the graph
% to plot velocity vs Drag force
subplot(2, 1, 1)
plot(v, f_d, 'color', [1 0 0], 'linewidth', 2.5)
title('velocity v/s drag force')
xlabel ('velocity')
ylabel ('drag force')
grid on
% to plot drag coefficient vs drag force
subplot(2, 1, 2)
plot(c_d, f_d, 'color', [0 0.5 0], 'linewidth', 2.5)
title('drag coefficient v/s drag force')
xlabel ('drag coefficient')
ylabel ('drag force')
grid on
PROCEDURE
- The problem is solved using MATLAB.
- Using linspace command 7 value between 10 to 45 is considered for velocity.
- 7 different values of drag coefficient are considered for various shape.
- Frontal area is taken as A = 0.36 which is constant throughout.
- We know that the density of air is pre-defined i.e. rho = 1.225 which is constant throughout.
- Then applying the formula (f_d = 0.5*rho*A*v.^2.*c_d) and calculating drag force.
- Then the code is written to plot the graph.
- Subplot command is used to plot both the graph on the same page.
- Colour and width of the line in the plot is set according to the convenience.
- All the component of the plot is labelled accordingly.
- Finally, we get the desired output and hence the desired plot.
OUTPUT:
OUTPUT GRAPH PLOTTING:
- GRAPH PLOT - 1: Velocity vs Drag force
Since drag force is directly proportional to the square of the velocity. Therefore, we can say that if velocity is increased two times then drag force will be increased by four times.
- GRAPH PLOT - 2: Drag coefficient vs Drag force
Since drag force is directly proportional to the drag coefficient. Therefore, we can say that if the drag coefficient is increased then drag force will be increased also increase accordingly.
RESULT:
Hence, we have successfully calculated the required drag force and also successfully plotted the graph.