Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

y = [ A ( 1 , : ) * * x ; A ( 2 , : ) * * x , dots; A

y=[A(1,:)**x;A(2,:)**x,dots;A(m,:)**x]
that is
y(1)=A(1,:)**x
y(2)=A(2,:)**x
dots
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:
Extract the dimension of A using the command size and store the result in the variables m and n.
Extract the dimension of x using the command size and store the result in the variables p and q
Use an if statement to perform a check on the dimensions to determine whether the multiplication is defined and whether x is a column vector
If the multiplication is defined and x is a column vector:
initialize the vector y as a vector of zeros of the appropriate dimension
use a single for loop to evaluate the entries of the product y=Ax. The loop counter should be the variable i. Each iteration of the for loop should evaluate the ith component of the vector y as the product of the ith row of A times the vector x. Also, inside the for loop, after you compute the ith component of y, insert the following commands:
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions

Question

define what is meant by the term human resource management

Answered: 1 week ago