Write a Matlab program to calculate drag force against a cyclist. Problem Statement
Theory
Drag Force:A drag force is the resistance force caused by the motion of a body through a fluid, such as water or air. A drag force acts opposite to the direction of the oncoming flow velocity. This is the relative velocity between the body and the fluid.
Code
close all
clear all
clc
%Write a Matlab program to calculate drag force against a cyclist.
c_d=0.8;
%frontal area(m^2)
A=0.1
%density(kg/m^3)
rho=1.2
%bicycle velocity(m/s)
velocity=[1:50];
drag_force=0.5*c_d*rho*A*velocity.^2
plot(velocity,drag_force)
xlabel('Velocity')
ylabel('Drag Force')
Results
A =
0.1000
rho =
1.2000
drag_force =
Columns 1 through 10
0.0480 0.1920 0.4320 0.7680 1.2000 1.7280 2.3520 3.0720 3.8880 4.8000
Columns 11 through 20
5.8080 6.9120 8.1120 9.4080 10.8000 12.2880 13.8720 15.5520 17.3280 19.2000
Columns 21 through 30
21.1680 23.2320 25.3920 27.6480 30.0000 32.4480 34.9920 37.6320 40.3680 43.2000
Columns 31 through 40
46.1280 49.1520 52.2720 55.4880 58.8000 62.2080 65.7120 69.3120 73.0080 76.8000
Columns 41 through 50
80.6880 84.6720 88.7520 92.9280 97.2000 101.5680 106.0320 110.5920 115.2480 120.0000
program 2
- Write a program to plot Drag Co-efficient vs Drag force
Code
close all
clear all
clc
%Write a Matlab program to calculate drag force against a cyclist.
c_d=[1.28,1.44,0.47,0.295,0.045];
label=["flat plate","prism","sphere","bullet","airfoil"];
%frontal area(m^2)
A=0.1
%density(kg/m^3)
rho=1.2
%bicycle velocity(m/s)
velocity=1
drag_force=0.5*c_d*rho*A*velocity.^2
plot(c_d,drag_force,"ro-")
xlabel('Drag cofficient')
ylabel('Drag Force')
text(c_d,drag_force,label)
Output
A =
0.1000
rho =
1.2000
velocity =
1
drag_force =
0.0768 0.0864 0.0282 0.0177 0.0027