Question: Use the exact Function and Variable names shown below in your scripts 8.1 Create a Function on Scilab that called Energy that calculates the Potential
Use the exact Function and Variable names shown below in your scripts
8.1 Create a Function on Scilab that called Energy that calculates the Potential Energy, Kinetic Energy, and the Total Energy of an object. Use the equations and the variables below to calculate the energies.
PE=mgh KE=(1/2)mv2 TE = PE + KE Use the variables shown below PE = Potential Energy (Nm) KE = Kinetic Energy (Nm) m = Mass (in kilograms) g = Gravity (use a constant 9.81 m/s2) h = Height (meters) v = Velocity (m/s) TE=Total Energy (Nm)
The user will enter the following (with numbers entered for mass, height, and velocity)
[PotEnergy, KinEnergy, TotEnergy] = Energy(mass,height,velocity)
Your Function will then output the Potential Energy, Kinetic Energy, and Total Energy.
Sample Answer, if the user inputs Energy(4,5,6), your Function should output PotEnergy = 196.2 KinEnergy = 72.00 TotEnergy = 268.2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
