Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Matab
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago