Project

MATLAB: Drag force on a Bicycle

The drag force on a bicycle can be calculated and a plot of velocity versus drag force gives us an idea how drag force increases with velocity exponentially.

Program:

% A program to calculate the drag force on a bicycle
function [D] = drag_parameters(a, v, rho, first, last)

% Inputs
% 1. Frontal Area m^2 
% 2. Velocity m/s
% 3. Density kg/m^3 rho = 1.2;
% 4. Drag coefficient 
c_d = linspace(first,last,100);

% Drag Force
D = 0.5*rho*v.*v.*a.*c_d;
% Use the command written below with your own input values to get a plot.
% D = drag_parameters(0.1, 1:100, 1.2, 1, 5), v = 1:100, plot(v, D), grid on, xlabel('Velocity'), ylabel('Drag_force')
end

Step wise explanation of the program:

  1. A function 'drag_parameters' is defined with inputs of frontal area, velocity, density, first value of drag coeffcient, last value of drag coeffcient and an output D.
  2. The drag coeffcient is defined by 'linspace' command giving 100 values between the inputs - first and last.
  3. The drag force is defined by the formula D = 0.5*rho*v.*v.*a.*c_d
  4. In the command window, the function is called with the input values and a plot of velocity vs drag force is obtained.
  5. Function call:D = drag_parameters(0.1, 1:100, 1.2, 1, 5), v = 1:100, plot(v, D), grid on, xlabel('Velocity'), ylabel('Drag_force')
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.