Drag Force for multiple velocity inputs and multiple drag coefficient inputs
1. Code for Drag Force vs Velocity Graph (Drag coefficient being constant)
% Calculation of Drag Force
clear all
close all
clc
% Inputs
density = 1.35; % the value of density (kg/m^3)
area = 5; % the value of frontal area (m^2)
vel = [20:45]; % the value of velocity (m/s)
cd = 0.5; % Constant drag coefficient
% Drag Force (N)
drag = 0.5*density*area*vel.^2*cd;
%Graph
plot(vel,drag,\'color\',\'r\')
grid on
xlabel(\"Velocity (m/s^2)\")
ylabel(\"Drag Force (N)\")
saveas(gcf(),\"C:/Users/Venki_LFC/Documents/Study/Octave/drag_curve.jpg\")
2. Code for Drag Force vs Drag Coefficiet (Drag coefficient for different shapes)
The code has drag cofficient for following shapes:
Streamlined body = 0.04
Streamlined Half Body = 0.09
Half-Sphere = 0.42
Sphere = 0.47
Long Cylinder = 0.82
Short Cylinder = 1.15
% Calculation of Drag Force
clear all
close all
clc
% Inputs
density = 1.35; % the value of density (kg/m^3)
area = 5; % the value of frontal area (m^2)
vel = 40; % the value of velocity (m/s)
cd = [0.04 0.09 0.42 0.47 0.82 1.15]; % drag coefficient for various shapes
% Drag Force (N)
drag = 0.5*density*area*vel^2.*cd;
% Graph
plot(cd,drag,\'color\',\'b\')
grid on
xlabel(\"Drag Coefficient\")
ylabel(\"Drag Force (N)\")
saveas(gcf(),\"C:/Users/Venki_LFC/Documents/Study/Octave/drag_curve_cd.jpg\")