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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!