
Write a user-defined MATLAB
TA is a two-element
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.)

Want to see the full answer?
Check out a sample textbook solution
Chapter 7 Solutions
MATLAB: An Introduction with Applications
- Don’t solve questionsarrow_forwardFred needs to choose a password for a certain website. Assume that he will choose an 8-character password, and that the legal characters are the lowercase letters a, b, c, ..., z, the uppercase letters A, B, C, ..., Z, and the numbers 0, 1, . . ., 9. (a) How many possibilities are there if he is required to have at least one lowercase letter in his password? (b) How many possibilities are there if he is required to have at least one lowercase letter and at least one uppercase letter in his password? (c) How many possibilities are there if he is required to have at least one lowercase letter, at least one uppercase letter, and at least one number in his password?arrow_forwarda =1500, b=1700 what is percentage of a is barrow_forward
- A 12-inch bar that is clamped at both ends is to be subjected to an increasing amount of stress until it snaps. Let Y = the distance from the left end at which the break occurs. Suppose Y has the following pdf. f(y) = { (a) Compute the cdf of Y. F(y) = 0 0 y -옴) 0 ≤ y ≤ 12 1- 12 y 12 Graph the cdf of Y. F(y) 1.0 0.8 0.6 0.4 0.2 y 2 6 8 10 12 F(y) F(y) F(y) 1.01 1.0ㅏ 1.0 0.8 0.6 0.4 0.2 0.8 0.8 0.6 0.4 ཨཱུ སྦེ 0.6 0.4 0.2 2 4 6 8 10 12 (b) Compute P(Y ≤ 5), P(Y > 6), and P(5 ≤ y ≤ 6). (Round your answers to three decimal places.) P(Y ≤ 5) = P(Y > 6) = P(5 ≤ y ≤ 6) = (c) Compute E(Y), E(y²), and V(Y). E(Y) = in E(Y2) v(x) = in 2 2 2 4 6 8 10 12 y 2 4 6 8 10 12arrow_forwardA restaurant serves three fixed-price dinners costing $12, $15, and $20. For a randomly selected couple dining at this restaurant, let X = the cost of the man's dinner and Y = the cost of the woman's dinner. The joint pmf of X and Y is given in the following table. p(x, y) 15 y 12 20 12 0.05 0.10 0.35 x 15 0.00 0.20 0.10 20 0.05 0.05 0.10 (a) Compute the marginal pmf of X. x 12 Px(x) Compute the marginal pmf of Y. y Pyly) 12 15 20 15 20 (b) What is the probability that the man's and the woman's dinner cost at most $15 each? (c) Are X and Y independent? Justify your answer. X and Y are independent because P(x, y) = Px(x) · Py(y). X and Y are not independent because P(x, y) =Px(x) · Pyly). X and Y are not independent because P(x, y) * Px(x) · Py(y). X and Y are independent because P(x, y) * Px(x) · Py(y). (d) What is the expected total cost, in dollars, of the dinner for the two people? $ (e) Suppose that when a couple opens fortune cookies at the conclusion of the meal, they find the…arrow_forwardLet X = the time between two successive arrivals at the drive-up window of a local bank. If X has an exponential distribution with λ = 1, (which is identical to a standard gamma distribution with α = 1), compute the following. (If necessary, round your answer to three decimal places.) (a) the expected time between two successive arrivals (b) the standard deviation of the time between successive arrivals (c) P(X ≤ 1) (d) P(2 ≤ X ≤ 4) You may need to use the appropriate table in the Appendix of Tablesarrow_forward
- Algebra & Trigonometry with Analytic GeometryAlgebraISBN:9781133382119Author:SwokowskiPublisher:CengageLinear Algebra: A Modern IntroductionAlgebraISBN:9781285463247Author:David PoolePublisher:Cengage Learning
