Create a single script file to answer the following problems
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 --------------
------------------------------------------------------

