Question
Write a function that calculates the kinetic and potential energy of a falling object. It should take three inputs: h1, the height the object was
Write a function that calculates the kinetic and potential energy of a falling object. It should take three inputs: h1, the height the object was dropped from, h2, the height the object is currently at, and m, the mass of the object. It should return the outputs ke, the kinetic energy of the object, and pe, the potential energy of the object. As we will assume the object is on earth, near sea level, but in a vacuum, our equations are:
ke=m*g*(h1-h2)
pe=m*g*h2
Where g is 9.81m/s^2. Assume all other variables are in appropriate units.
Once you have written this function, write the proper syntax for calling this function elsewhere in MATLAB. Use appropriate inputs (i.e. actual values) when writing this syntax.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started