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
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.