Create a single script file to answer the following problems

Create a single script file to answer the following problems. Remember not to store any values in the default variable an*. Write introductory comments for each problem including the problem description, input, processing, and output immediately before each problem. Use the commands cle and clear at the beginning of your script file. Terminal velocity is defined as the velocity at which the force of an object falling is balanced by the drag force from the air when an object falls from a sufficient height. The terminal velocity may be calculated using the formula v_1 = squareroot 2mg/rho AC_d Where v_t is the terminal velocity, m is the mass of the object (kg), g is acceleration due to gravity (9.81 m/s^2), p is the density of air (1. 18 kg/m^3), A is the cross section of the object (m^2), and Cd is the drag coefficient (use 0.3). Use the help function in MATLAB to determine how the logspace function works. Then use the logspace function to create a row vector that contains the values of 100, 1000, 10000, and 100000 kg. Using this row vector and array operators/functions calculate the terminal velocity vector in m/s assuming the cross section of the object is 45 m^2. (Do NOT write an assignment statement for each element of the row vector or use loops) Convert these values to mi hr.

Solution

Matlab code with description is givn below:

#################################################################### CODE START


% Problem description:-
% 1. Create row vector m with help of \"logspace\" function in Matlab.
% 2. Calculate the terminal velocity with help of equation given in problem
%     without using any loops (for or while).

% INPUT:-
% Variable for this problem is defined as :
% g is gravitational acceleration in (m/s^2)    = 9.81 m/s^2
% rho is density of medium (kg/m^3)             = 1.18 kg/m^3
% A is cross section area of object (m^2)       = 45   m^2
% Cd is drag coefficient                        = 0.3
% v_t is terminal velocity (m/s)                : To be calculate
% m is mass of object in (kg)                   : Create matrix with logspace

% logspace(a,b,n) create vector between 10^a to 10^b having n values.
% logspace(2,5,4) create vector between 10^2 to 10^5 having 4 values.

m = logspace(2,5,4);
g = 9.81 ;
rho = 1.18 ;
A = 45 ;
Cd = 0.3 ;

% PROCESSING:-
% Calculate Terminal Velocity.
% note 1 : sqrt is matlab function that calculate square root of the value
%          given in the bracket : ex: square root of number \'2\' can be written by sqrt(2).

v_t = sqrt( (2*(m*g))/(rho*A*Cd) ) ;

% CONVERTING IN TO MILES PER HOUR
% Convert Miles per hour: multiply m/s with 2.236936292

v_t_mphr = 2.236936292 * v_t ;

% OUTPUT
fprintf(\'------------------------------------------------------\ \');
fprintf(\'\ Terminal Velocity in (m/s) is : \ \ \');
disp(v_t\');
fprintf(\'------------------------------------------------------\ \');
fprintf(\'Terminal Velocity in (miles/hour) is :\ \ \');
disp(v_t_mphr\');
fprintf(\'------------------------------------------------------\ \');
fprintf(\'\ \ \');

% OPTIONAL

fprintf(\'------------------------------------------------------\ \');
fprintf(\'--------------      Have a Nice Day     --------------\ \');
fprintf(\'------------------------------------------------------\ \');

#################################################################### CODE END

------------------------------------------------------
--------------      Have a Nice Day     --------------
------------------------------------------------------

 Create a single script file to answer the following problems. Remember not to store any values in the default variable an*. Write introductory comments for eac
 Create a single script file to answer the following problems. Remember not to store any values in the default variable an*. Write introductory comments for eac

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site