A Matlab program to calculate drag force against a cyclist
Aim:- To calculate drag force against a cyclist.
Governing Equations:-
By using this formula, we can calculate the drag force.
Drag force = rho*A*V^2*cd*0.5
Where,
rho = Density kg/m^3
A = Area m^2
V = Velocity m/sec
cd = Drag coefficient–no units
Objectives of the project:-
To write a MATLAB program to calculate drag force against a cyclist.
To write a MATLAB program to plot graph of “Velocity vs Drag force”.
To write a MATLAB program to plot graph of “Drag coefficient vs Drag force”.
Programming using MATLAB:-
>> % A program to plot Velocity vs Drag force
>> % The Inputs are
>> % Density kg/m^3
>> rho = 600;
>> % Frontal Area m^2
>> A = 0.1;
>>
>> % Velocity m/sec
>> V = [10:50];
>> % Drag coefficient
>> c_d = 0.47;
>> % The Output for the above input code is
>> drag_force = rho*A*V.^2*c_d*0.5
drag_force =
1.0e+04 *
Columns 1 through 18
0.1410 0.1706 0.2030 0.2383 0.2764 0.3172 0.3610 0.4075 0.4568 0.5090 0.5640 0.6218 0.6824 0.7459 0.8122 0.8812 0.9532 1.0279
Columns 19 through 36
1.1054 1.1858 1.2690 1.3550 1.4438 1.5355 1.6300 1.7272 1.8274 1.9303 2.0360 2.1446 2.2560 2.3702 2.4872 2.6071 2.7298 2.8552
Columns 37 through 41
2.9836 3.1147 3.2486 3.3854 3.5250
>> % Plotting of Velocity vs Drag force
>> plot(V, drag_force, 'Color','g')
>> grid on
>> xlabel('Velocity')
>> ylabel('Drag force')
>> % A MATLAB Program to plot Drag coefficient vs Drag force.
>> % The Inputs are
>> % Density
>> rho = 600;
>> % Frontal Area
>> A = 0.1;
>> % Velocity
>> V = [10:50];
>> % In this case We need to take Drag coefficient as
>> c_d = [0.2 0.4 0.6 0.8 1.0];
>> % Drag force
>> drag_force = rho*A*V.^2*c_d*0.5
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise
multiplication, use '.*'.
>> drag_force = rho*A*0.5*V.^2.*c_d
Matrix dimensions must agree.
>> drag_force = rho*A*V.^2.*c_d*0.5
Matrix dimensions must agree.
>> % changing the value of Velocity to a single value
>> V = 5
V =
5
>> drag_force = rho*A*V^2.*c_d*0.5
drag_force =
150 300 450 600 750
>> % So here we have changed the value of Velocity because of the matrix dimension error and in this case we are considering the Drag coefficient vs Drag Force So the velocity must be changed
>> % Now lets Plot the graph of Drag coefficient vs Drag force
>> plot(c_d, drag_force, 'color','y')
>> grid on
>> xlabel('Drag coefficient')
>> ylabel('Drag force')
Screenshots of my code and output:-
Output of Plots:-
Conclusion:-
So, upto this we,
- Wrote a MATLAB program to calculate drag force against a cyclist.
- Wrote a MATLAB program to plot graph of “Velocity vs Drag force”.
- Wrote a MATLAB program to plot graph of “Drag coefficient vs Drag force”.
And we can see the outputs for these above Objectives and also the graph output variation with the two cases.