Question 21 (a) Evaluate the following MATLAB functions and show your answers. (i) x = [2, 9, 4; 6, 8, 5] max(x) (ii) x
Posted: Sun Jul 03, 2022 9:59 am
Question 21 (a) Evaluate the following MATLAB functions and show your answers. (i) x = [2, 9, 4; 6, 8, 5] max(x) (ii) x [2, 9, 4; 6, 8, 5] [a,b] = max(x) (iii) x= [2, 9, 4; 6, 8, 5] mean(x) (iv) x [2, 9, 4; 6, 8, 5; 3, 7, 1] median(x) (v) x [2, 9, 4; 6, 8, 5] cumprod(x) [10 marks] (b) Write a MATLAB program that calculates the parcels postage charges by a delivery agent. [10 marks] The formula of the charge is as follows: A = Q *T*R /100 Where Q = Qty of items in the parcels T = time taken (in days) in delivery the items to the destination R = the rate of delivery where R = 2.5 when T> 3 and R = 1.5 if T is less than or equal to 3 days. Your program should prompt the user to input the quantity Q and the number of days T. Your code will determine the R based on the inputs to compute the amount A. 2 sample inputs/outputs are as follows: