Plot of drag force vs velocity and drag force vs drag coefficients for various shapes
%(1)drag force vs velocity
clear all
close all
clc
%inputs
rho = 1.225; %density kg/m^3
A = 0.5; %frontal area m^2
v = linspace(10,50,10); %velocity m/s^2
c_d = 0.75;
%drag force
F = 0.5*rho*A*v.^2*c_d; %Newton
%plottinng
plot(v,F,'-o','linewidth',2,'color','b');
xlabel('velocity');
ylabel('drag force');
grid on
grid minor
%end of code
o-o-o-o-o-o-o-o-o-o
%(2)drag force vs drag coeff
clear all
close all
clc
%inputs
rho = 1.225; %density (kg/m^3)
D = 0.4; %diameter of sphere, cylinder and cone and side of cube (m)
v = 35; %velocity (m/s)
h = 2; %height of cylinder
%frontal areas of various shapes (m^2)
A(1) = D^2; %area of cube
A(2) = 0.25*pi*D^2; %area of sphere
A(3) = 0.25*pi*D^2; %area of cone
A(4) = 0.25*pi*D^2; %area of short cylinder
A(5) = 0.25*pi*D^2; %area of long cylinder
%drag coefficients
c_d(1) = 1.05; %cube
c_d(2) = 0.47; %sphere
c_d(3) = 0.50; %cone
c_d(4) = 1.15; %short cylinder
c_d(5) = 0.82; %long cylinder
%drag force
for i = 1:length(c_d)
F(i) = 0.5*rho*A(i)*v^2*c_d(i);
end
%plotting
hold on
for j = 1:length(c_d)
plot(c_d(j),F(j),'-x','linewidth',2,'color','r');
end
hold off
xlabel('Drag Coefficient');
ylabel('Drag Force');
grid on;
grid minor;
%end of code
o-o-o-o-o-o-o-o-o