make mathlab code
Extracted text: (Matrix-Vector Multiplication) The product of a matrix A and a (column) vector i is defined provided the number of columns of A is equal to the number of rows of 7. Suppose this is the case, and let A be m × n and ë be n × 1. Then, the product Aï is defined element-wise by (AF); = Aj,k® k- For this problem, do not use the built-in ability to multiply matrices and vectors. mat_vec Function: Input variables: • a matrix representing A • a vector representing Output variables: • a vector representing At; if the sizes do not match, return an empty vector (produced by [] in MATLAB) A possible sample case is: » b = mat_vec([1 2 ; 2 1], [2 ; -2]) b = -2 2 b = mat_vec([1 2 ; 3 4], [5]) [] (0x0)
Extracted text: - (Minimum and Maximum) We often want to find the minimum and maximum values in a vector as well as the indices at which these values occur. For this problem do not use the built in min or max function (or any other function which trivializes the problem). min_max Function: Input variables: • a vector representing the list of numbers; you may assume each value is unique Output variables: • a scalar representing the minimum value • a scalar representing the index where minimum value is located in the list • a scalar representing the maximum value • a scalar representing the index where maximum value is located in the list A possible sample case is: » [min_val, min_i, max_val, max_i] = min_max(1:5) min_val = 1 min_i max_val = max_i = 1 5 » [min_val, min_i, max_val, max_i] = min_max([2, 3, 7, 1, 4]) min_val = 1 min_i 4 max_val = max_i = 3 7 » [min_val, min_i, max_val, max_i] = LXX_QYY([1, 2, 3, 4, -1, 0]) min_val = -1 min_i max_val = %3D 4 max_i = 4