Menu

P1 Write Matlab Function Inputs M N Two Positive Integers Matrix Size M Xn Vector X Size N Q43808357

P1. Write a MATLAB function with inputs • m and n, two positive integers, • a matrix A of size m xn, • a vector x of size n x

P1. Write a MATLAB function with inputs • m and n, two positive integers, • a matrix A of size m xn, • a vector x of size n x1, and which outputs the product vector A x x (note that the size of this vector should be m x 1). Your code should check that the sizes of the inputs are right and then do the multiplication using two nested “for” loops. a) How many floating point operations (additions and multiplications) does the code use? Find a formula in terms of m and n. Show transcribed image text P1. Write a MATLAB function with inputs • m and n, two positive integers, • a matrix A of size m xn, • a vector x of size n x1, and which outputs the product vector A x x (note that the size of this vector should be m x 1). Your code should check that the sizes of the inputs are right and then do the multiplication using two nested “for” loops. a) How many floating point operations (additions and multiplications) does the code use? Find a formula in terms of m and n.

Expert Answer


Answer to P1. Write a MATLAB function with inputs • m and n, two positive integers, • a matrix A of size m xn, • a vector x …

OR