a new title
%A program to calculate the drag force on a bicycle
clear all
close all
clc
%Inputs
%Drag froce (for same frontal area and different shapes)
% 1) C_d (cyclist hoods) = 1
% 2) C_d (cyclist tops) = 1.15
% 3) C_d (cyclist drops) = 0.88
% 4) C_d (aero bars) = 0.7
C_d = [0.7, 0.88, 1, 1.15];
%Frontal area (m^2)
A = 0.1;
%Density (kg/m^3)
rho = 1.2;
%Velocity (m/s)
v =[1:10];
%Plotting
for i=1:length(C_d)
drag_force = 0.5 * rho * A * v.^2 * C_d(i);
hold on
plot(v, drag_force)
axis([0 10 0 8])
legend('aerobars','drops','hoods','tops')
xlabel('Velocity','color','r')
ylabel('Drag force','color','r')
grid on
pause(2)
end
pause(5)
for i=1:length(v)
drag_force = 0.5 * rho * A * v(i).^2 * C_d;
plot(C_d, drag_force)
axis([0.6 1.2 0 8])
legend('1m/s','2m/s','3m/s','4m/s','5m/s','6m/s','7m/s','8m/s','9m/s','10m/s')
xlabel('Cd','color','g')
ylabel('Drag force','color','g')
grid on
pause(0.5)
end
PROBLEMS FACED
- Since both velocity and drag coeffcients were matrices of different dimensions it was difficult to to multiply both at the same time in the drag force formula.
- To overcome this probelm I used a for loop where in for each value of either velocity or drag coefficient the drag force was calculated, iterated and the plotting was done.
- It was difficult to name every curve in the plot.
- I had to find an inbuilt function to name every curve. I had to look for this function on internet and it was found to be "legend".
CONCLUSION
- From the plot of Velocity versus Drag froce it was found that drag force varies parabolically with velocity for the same values of drag coefficient.
- From the plot of Drag coefficient versus Drag froce it was found that drag force varies linearly with drag coefficient for the same values of velocity.