MATLAB: An Introduction with Applications
MATLAB: An Introduction with Applications
6th Edition
ISBN: 9781119256830
Author: Amos Gilat
Publisher: John Wiley & Sons Inc
bartleby

Videos

Textbook Question
Book Icon
Chapter 7, Problem 13P

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,api,TB,ap2). The input arguments to the function 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.

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 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 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 elapsed between the following events:

(a) Event A: 5:37 AM: Event B: 2:51 PM.

(b) Event A: 12:53 PM: Event B: 6:12 PM.

(c) Event A: 11:32 PM: Event B: 3:18 PM. (Error situation.)

Blurred answer
Students have asked these similar questions
How to determine if the vector ~b is in the range of T
State the properties of the Bassel function.
Construct the following vector.

Chapter 7 Solutions

MATLAB: An Introduction with Applications

Ch. 7 - Write a user-defined function that calculates...Ch. 7 - Write a user-defined MATLAB function that...Ch. 7 - Write a user-defined MATLAB function that...Ch. 7 - Write a user-defined MATLAB function that...Ch. 7 - Prob. 15PCh. 7 - The area of a triangle ABC can be calculated by:...Ch. 7 - As shown in the figure, the area of a convex...Ch. 7 - Write a user-defined function that determines the...Ch. 7 - Write a user-defined MATLAB function that converts...Ch. 7 - Write a user-defined function that plots a...Ch. 7 - Write a user-defined function that plots an...Ch. 7 - Prob. 22PCh. 7 - Write a user-defined function that determines if a...Ch. 7 - The harmonic mean H of a set of n positive numbers...Ch. 7 - Write a user-defined function that determines the...Ch. 7 - Write a user-defined function that determines the...Ch. 7 - Write a user-defined function that sorts the...Ch. 7 - Write a user-defined function that sorts the...Ch. 7 - Write a user-defined MATLAB function that finds...Ch. 7 - Write a user-defined MATLAB function that...Ch. 7 - The shortest distance between two points on the...Ch. 7 - Delta rosette is a set of three strain gages...Ch. 7 - In a lottery the player has to select several...Ch. 7 - 34. The Taylor series expansion for sin x about x...Ch. 7 - Write a user-defined function that determines the...Ch. 7 - The area moment of inertia Ixe of a rectangle...Ch. 7 - The simple RC high-pass filter shown in the figure...Ch. 7 - A circuit that filters out a certain frequency is...Ch. 7 - The first derivative df(x)dx a function f(x) at a...Ch. 7 - In lottery the player has to guess correctly r...
Graph Theory: Euler Paths and Euler Circuits; Author: Mathispower4u;https://www.youtube.com/watch?v=5M-m62qTR-s;License: Standard YouTube License, CC-BY
WALK,TRIAL,CIRCUIT,PATH,CYCLE IN GRAPH THEORY; Author: DIVVELA SRINIVASA RAO;https://www.youtube.com/watch?v=iYVltZtnAik;License: Standard YouTube License, CC-BY