Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Please read these instructions before you attempt to solve this problem. Download the live script file MAT 3 4 3 lab 2 ex 4 m
Please read these instructions before you attempt to solve this problem. Download the live script file MATlabex and open it with matlab. Run the file and use the information provided to complete the following exercise. For your convenience, a pdf vereion 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 of an matrix A times a column vector dots, can be computed rowwise as below: ;dotsA that is : Write a function named myrowproduct that takes in input a matrix a column vector and a random number and as output gives the product computed by row as detined above, and the intermediate value, of the output vector at the end of 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 and Extract the dimension of using the command size and stor? The result in the variables and Use an if statement to perform a check on the dimensions to fetermine whether the multiplication is defined and whether is a column vector. If the multiplication is defined and is a column vector: initialize the vector as a vector of zeros of the appropriate dimension use a single for loop to evaluate the entries of the product The loop counter should be the variable i Each iteration of the for loop should evaluate the ith component of the vector as the product of the ith row of A times the vector Also, inside the for loop, after you compute the ith component of insert the following
Please read these instructions before you attempt to solve this problem.
Download the live script file MATlabex and open it with matlab. Run the file and use the information provided to complete the following exercise. For your convenience, a pdf vereion 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 of an matrix A times a column vector dots, can be computed rowwise as below:
;dotsA
that is
:
Write a function named myrowproduct that takes in input a matrix a column vector and a random number and as output gives the product computed by row as detined above, and the intermediate value, of the output vector at the end of 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 and
Extract the dimension of using the command size and stor? The result in the variables and
Use an if statement to perform a check on the dimensions to fetermine whether the multiplication is defined and whether is a column vector.
If the multiplication is defined and is a column vector:
initialize the vector as a vector of zeros of the appropriate dimension
use a single for loop to evaluate the entries of the product The loop counter should be the variable i Each iteration of the for loop should evaluate the ith component of the vector as the product of the ith row of A times the vector Also, inside the for loop, after you compute the ith component of insert the following
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started