Project

Week 1 - Flow over Bicycle

1: PROGRAM TO PLOT VELOCITY VS DRAG FORCE.

% Incorporate A Function To Plot Velocity vs Drag Forceclose allclear allclc%Inputc_d = 0.25; % Drag Coefficientrho = 1.2;  % Density in kg/m^3v = [1:10]  % Velocity in m/sa = 0.1;    % Area in m^2% Calculating Drag Forcedrag_force = rho*v.^2*a*c_d*0.5% Ploting Velocity VS Drag Forceplot(v, drag_force)% Labelling X-Axis as Velocityxlabel('Velocity')% Labelling Y-Axis Drag Forceylabel('Drag Force')% Turning ON Gridgrid on

EXPLANATION OF CODE

Step 1: We will be starting with clear all, close all, clc

Step 2: Then the values of variables used in formula of Drag Force will be assumed as follows

drag coefficient = c_d= 0.25 (drag coefficient is dimensionless so it is has no unit)

density of air = rho = 1.2 (unit of density is kg/m^3)

frontal area = a = 0.1 ( unit of area is m^2)

here the velocity is matrix and containing the values from 1 upto 10 in an array.

velocity = v = [1:10] (the colon(:) is an operator which is used to depict the starting point & ending point.

Step 3: Then now for calculating drag force which is equal to density times velocity square times area times drag coefficient times 0.5. Here multiplication will be done by an asterisk command(*). Velocity square is an elementwise opertaor because it is having power 2 so here we cannot just use (*) asterisk, because it will be showing error, so we have to use (.) followed by (*) in between velocity and 2 as (v.*2). For different velocity values different values of drag force will be created.

Step 4: Now plotting is done by using plot(_,_). Here by opening the parenthesis just after writing plot, matlab will automatically showing the first values will be for x-axis and second value will be for y-axis. So the x-axis axis will be having the values for different velocity and y-axis will having different values for drag force corresponding to different velocity.

Step 5: So as to, for easy to understand that which axis depicts which of the variables values, we will be using xlabel('___'), ylabel('___'). For x-axis velocity will be labelled and for y-axis drag force will be labelled.

Step 6: Turning grid on will make the plot more easier to understand.

RESULT SHOWN IN COMMAND WINDOW :

RESULT OF PLOT :

SCREENSHOT SHOWS ERROR IN COMMAND WINDOW :

It's an for elementwise operator, i've use (v^2) instead for (v.^2) . Step taken to overcome the error i've inserted dot(.) in between velocity and cap followed by 2.

CONCLUSION :

Drag force is propotional to velocity square. If drag force is increasing by 1 times then velocity will be increasing by 2 times.

2: PROGRAM TO PLOT DRAG COEFFICIENT VS DRAG FORCE.

% Incorporate A Function To Plot Drag Coefficient vs Drag Forceclose allclear allclc% Inputs = 0.47;     % Drag Coefficient of Sphereh_s = 0.42;   % Drag Coefficient of Half Spherel_c = 0.82;   % Drag Coefficient of Long_Cylinders_c = 1.15;   % Drag Coefficient of Short Cylinders_b = 0.04;   % Drag Coefficient of Streamlined bodys_h_b = 0.09; % Drag_Coefficient of Streamlined half bodyv = 2;        % Velocity in m/sa = 0.1;      % Area in m^2rho = 1.2;    % Density in kg/m^3% Drag Coefficient in an Arrayc_d = [s_b, s_h_b, h_s, s, l_c, s_c] % Calculating Drag Forcedrag_force = rho*c_d*v*v*a*0.5 % Plotting Drag Coefficient VS Drag Forceplot(c_d, drag_force)  % Labelling X-Axis as Drag Coefficientxlabel('Drag Coefficient')% Labelling Y-Axis as Drag Forceylabel('Drag Force')  % Turning ON Gridgrid on   

EXPLANATION OF CODE

Step 1: As usual will be starting as close all, clear all, clc

Step 2: As searched from internet drag coefficient for different shapes is taken as input. Values of Velocity(v), Frontal Area(a), Density(rho) is also assumed in the code.

Step 3: Here Drag Force is an matrix and will be containing the drag coefficients for different shapes in an array for further calculations.

Step 4: Now drag force will be calculated by formula which is density times drag coefficient times velocity times square area times 0.5. What is going to happen here is for every value of drag coefficients will be taken into calculating drag force and for that particular drag coefficient drag force will be calculated.

Step 5: By using plot(_,_) , for the two variables the values will be assigned on a particular axis. By opening parenthesis, the matlab will automically show the first values will be assigned to X-Axis and second values for Y-Axis.

Step 6: After assigning the values for the axis, so as to make the code more easy to understand the name will be provided for both the axis by using xlabel('____') & ylabel('____')

Step 7: Turning grid on will make the code easy to identify the values for a particular one value of a variable.

RESULT SHOWN IN COMMAND WINDOW :

RESULT OF PLOT :

SCREENSHOT SHOWS ERROR IN COMMAND WINDOW :

It's an typo error, left to use (^). Not any other error faced.

CONCLUSION : Here drag force is directly propotional to drag coefficient.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.