Question: Please read these instructions before you attempt to solve this problem. Download the live script file MAT 3 4 3 lab 2 ex 4 .

Please read these instructions before you attempt to solve this problem.
Download the live script file MAT343lab2ex4.mlx and open it with matlab. Run the file and use the information provided to complete the following exercise. For your convenience, a pdf version is also provided. Before you attempt this exercise, you might want to watch the last video of the video tutorials for this lab.
The product y=Ax of an mxn matrix A times a column vector x=(x1,x2,dots,xn)T can be computed row-wise as below:
y=[A(1,:)**x;A(2,:)**x;dots;A(m,:)**x]
that is
y(1)=A(1,:)**x
y(2)=A(2,:)**x
cdots
y(m)=A(m,:)**x
Write a function named myrowproduct that takes in input a matrix A, a column vector x and a random number k, and as output gives the product y=Ax computed by row as defined above, and the intermediate value, z, of the output vector at the end of k iterations (this intermediate value is used by MATLAB Grader to determine whether your code is correct).
Specific instructions for writing the function:
function [y,z]= myproductrow (A,x,k)
% This function evaluates the product A**x by row
% where A is a matrix and x is a vector
% Kortney Schaum
[m,n]=size(A);
[p,q]=size(x);
if n==p,&&,q==1
y=zeros(m,1);
z=[];
for i=1:k
y=A**x;
if i==k
z=y(1);
end
end
y=[];
z=[];
end
end
Code to call your function ?
C Reset
 Please read these instructions before you attempt to solve this problem.

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!