e user input is ‘MKS’, then the units will be in meters and seconds % If the user input is ‘FPS’, then the units will be in feet and seconds unit = input("Please choose a unit: MKS (meters and seconds) or FPS (feet and seconds): ", "s");

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

PLease explain the Matlab codes below in details: (reply asap)

% request the user to input the desired option with regard the unit
% if the user input is ‘MKS’, then the units will be in meters and seconds
% If the user input is ‘FPS’, then the units will be in feet and seconds
unit = input("Please choose a unit: MKS (meters and seconds) or FPS (feet and seconds): ", "s");
 
% conditional statements enable you to select at run time which block of code to execute
% in the situation where the user has input “MKS”
if (unit == "MKS" || unit == "mks")
% gravity is equivalent to -9.81
gravity = -9.81;
% in the situation where the user has input “FPS”
elseif (unit == "FPS" || unit == "fps")
% gravity is equivalent to -32.174
gravity = -32.174;
else
% in the situation where the user has input none of the provided options
error = " Please enter an input only within the provided options ";
% disp( ) displays the value of variable without printing the variable name
% display error
disp(error)
% return control to the invoking program before it reaches the end of the script or function
return
% to terminate statements
end
% for the variables needed in accordance with the formula
% request the user to input the desired value for the magnitude of the initial velocity
Vo = input("Enter magnitude of the initial velocity: ");
% request the user to input the desired value for the angle
theta = input("Enter angle: ");
% request the user to input the desired value for the height
h = input("Enter height: ");
% request the user to input the desired value for the acceleration
ax = input("Enter acceleration: ");
 
% mathematical formula equations
% formula equation for time
time = (Vo.*sind(theta) + sqrt((Vo.*sind(theta)).^2-2*gravity*h)) / (-gravity);
t = linspace(0,time);
 
% formula equation for velocity (x)
velocityx = Vo*(cosd(theta));
 
% formula equation for velocity (y)
velocityy = Vo*(sind(theta));
 
% formula equation for displacement (x)
displacementx = (velocityx.*t) + ((1/2)*ax*(t.^2));
 
% formula equation for displacement (y)
displacementy = (velocityy.*t) + ((1/2)*gravity*(t.^2));
 
% formula equation for final velocity (x)
finalvelocityx = sqrt(velocityx.^2 + 2*ax*displacementx);
 
% formula equation for final velocity (y)
finalvelocityy = sqrt(velocityy.^2 + 2*gravity*displacementy);
 
% formula equation for magnitude
magnitude = sqrt((finalvelocityx.^2)+(finalvelocityy.^2));
 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education