Question: Matab UAE Tolerance 10:00 AM ProblemSet4-Ch07.docx Write a user-defined MATLAB function that determines the time elapsed between two events during a day. For the function
UAE Tolerance 10:00 AM ProblemSet4-Ch07.docx Write a user-defined MATLAB function that determines the time elapsed between two events during a day. For the function name and arguments, use dttimediff (TA, ap1,TB, ap2). The input arguments to the func tion are: TA is a two-element vector with the time of the first event. The first element is the hour and the second element is the minute. apl 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 ele- ment is the hour and the second element is the minute ap2 is a string AM' or PM' which corresponds to the time of the second 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 secon 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 elapsed between the following events: (a) Event A: 5:37AM: Event B: 2:51PM (b) Event A: 12:53PM: Event B: 6:12PM (c) Event A: 11:32PM: Event B: 3:18PM. (Error situation.) Command Window >dttimedifr(ts 37),'AM.[2 51], 'PM dt 14 dttimediff ([12 53,PM', 16 12], PM') dt 19 dttimedirr (1i 32], "PM',13 18],PM ERROR: Event A should be before event E Open With Print
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
