Answered step by step
Verified Expert Solution
Link Copied!

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

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

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

Describe some variables used to measure the value added of HRM

Answered: 1 week ago

Question

find all matrices A (a) A = 13 (b) A + A = 213

Answered: 1 week ago