Project

Plotting the graph of drag forces due to flow of fluid over a bicycle and flow over objects of different shapes

% calculating drag force over a bicycle 

clear all
close all 
clc

% input parameters
   
   %drag coefficient
   c_d = 0.1
   % frontal area
   A = 0.1
   %density
   rho = 1.5
   % velocity
   v = [1:50];
   
drag_force = 0.5*rho*A*c_d*v.^2;

plot(v,drag_force,\'r\')
xlabel(\'velocity\')
ylabel(\'drag\')
grid on

 % plotting drag coefficient vs drag force for different shapes
 
 clear all
 close all
 clc
 
 % Input parameters
     % Frontal Area
     A = 0.1
     % Density of flowing fluid(in this case air)
     rho = 1.225
     % velocity
     v = 10
     
     % drag coefficient for different shapes 
     
        % streamlined body
        c_d1 = 0.04
        % sphere
        c_d2 = 0.47
        % cone
        c_d3 = 0.5
        %long cylinder
        c_d4 = 0.82
        % cube
        c_d5 = 1.02
        
   drag_force1 = 0.5*rho*A*v^2*c_d1;
   drag_force2 = 0.5*rho*A*v^2*c_d2; 
   drag_force3 = 0.5*rho*A*v^2*c_d3;
   drag_force4 = 0.5*rho*A*v^2*c_d4;
   drag_force5 = 0.5*rho*A*v^2*c_d5;
   
   %to obtain a continuous graph
   c_d = linspace(0.01,1.05,100)
   drag_force = 0.5*A*rho*v^2.*c_d;
   
   hold on
   plot(c_d,drag_force,\'color\',\'r\')
   plot(c_d1,drag_force1,\'*\',\'color\',\'b\')  
   plot(c_d2,drag_force2,\'*\',\'color\',\'b\')  
   plot(c_d3,drag_force3,\'*\',\'color\',\'b\')
   plot(c_d4,drag_force4,\'*\',\'color\',\'b\')
   plot(c_d5,drag_force5,\'*\',\'color\',\'b\')
   title(\'Variation of drag force with respect to drag coefficient\')
   xlabel(\'drag coefficient\')
   ylabel(\'drag force\')
   grid on
   
   

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.