Question: In this problem you will write two Matlab functions to compute the matrix-vector product of an nn matrix A and a length-n column-vector x. Note

In this problem you will write two Matlab functions to compute the matrix-vector product of an nn matrix A and a length-n column-vector x. Note that you can easily check the result of your functions by computing directly the product A*x and comparing the results.

(a) Write a function called arrow that takes as arguments an integer dimension n, an nn matrix A, and a length-n vector x and returns the result of computing the matrix-vector product b = Ax by the row-vector rule. Use vector operations only (that is, dont access elements of A or x individually). The value b returned by your function should be a column vector.

(b) Write a function called axcol that takes as arguments an integer dimension n, an nn matrix A, and a length-n vector x and returns the result of computing the matrix-vector product b = Ax by taking a linear combination of the columns of A. Use vector operations wherever possible. The value b returned by your function should be a column vector.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!