Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a user defined Matlab function that determines the time elapsed between two events during a day. For the function name and arguments, use dt=timediff(TA,
Write a user defined Matlab function that determines the time elapsed between two events during a day. For the function name and arguments, use dt=timediff(TA, ap1, TB, ap2). The input arguments to the function are:
TA is a two element vector with the time of he second event. The first element is the hour and the second element is the minute.
ap1 is a string 'AM' or 'PM' which corresponds to the time of the first event.
TB is a two element vector with the time of the second event. The first element is the hour and the second element the hour and the second element is the minute.
ap2 is a string 'AM' or 'PM' which corresponds to the time of the first event.
The output argument dt is a two element vector with the time elapsed between two events. The first element is the number of hours and the second element is number of minutes. The function displays an error message if the time entered for event B is before the time entered for event A. Use the function to determine the time elapesd between the following events:
a) Event A: 5:37AM; Event B: 2:51PM
b) Event A: 12:53AM: Event B: 6:12PM
c) Event A: 11:32PM; Event B: 3:18pm
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