creating plot between drag coefficient and drag force
% challenge 1 to plot drag force vs velocity
clear all
close all
clc
%inputs
%coeffecient of drag force c_d=0.5;
%area in m^2 A=0.2;
%density
rho=1.4
%velocity in m/s
v=[10:50]
drag_force=0.5*A*rho*c_d*v.^2;
plot(drag_force,velocity,'linewidth',3)
xlabel('dtrag_force')
ylabel('velocity')
grid on
%challenge 2 drag coefficient of various shapes and plot drag force as function of drag coefficient
clear all
close all
clc
%inputs
a=0.5; %meter^2
v=15; %m/s
rho=1.3;
%inputs for various c_d value
cd_sphere=0.47;
cd_cube=1.05;
cd_streamlined=0.04;
%taken origin
x0=0;
y0=0;
%2nd point for sphere
x2=cd_sphere;
y2=0.5*v^2*cd_sphere*rho*a;
%3rd point cd value for cube
x3=cd_cube;
y3=0.5*v^2*cd_cube*rho*a;
%1st point cd value for stramlined
x1=cd_streamlined;
y1=0.5*v^2*cd_streamlined*rho*a;
%plotting
line([x0 x1],[y0 y1],'linewidth',3,'color','g');
line([x1 x2], [y1 y2],'linewidth',3,'color','y');
line([x2 x3], [y2 y3],'linewidth',3,'color','r');
grid on
pause(0.3)
xlabel('cd_value');
ylabel('dragforce')