Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

7. The Kinetic Energy of the moving body is computed by KE = ½mv2 where m is mas

ID: 1770561 • Letter: 7

Question

7. The Kinetic Energy of the moving body is computed by KE = ½mv2 where m is mass in kg and v is velocity in m/sec. Write and execute a Matlab function that takes a body's mass and velocity as inputs and calculates the Kinetic Energy of the moving body for at least 5 mass-velocity pairs. Create an Excel spreadsheet with 10 rows of data inputs (mass and velocity). Create a new function that uses the KE function from part a that reads the input data from the spreadsheet, computes the Kinetic Energy, and posts the KE function result to a new column in the spreadsheet. The spreadsheet name can be 'hardcoded' (a fixed value) within your function a. b.

Explanation / Answer

(a) Matlab function:

function ke = myfunction (m,v)
ke= 0.5 .* m .* v.^2;

Output:

>> myfunction(2,5)

ans =

25

>> myfunction(4,10)

ans =

200

>> myfunction(3,6)

ans =

54

>> myfunction(8,2)

ans =

16

>> myfunction(4,1)

ans =

2

(b) Excel function:

Function KINETIC(m, v)
KINETIC = 0.5 * m * v * v
End Function

Mass Velocity Kinetic Energy 2 1 1 4 2 8 6 3 27 8 4 64 10 5 125 12 6 216 14 7 343 16 8 512 18 9 729 20 10 1000
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote