Mathematics
Mathematics, 13.02.2020 04:26, cashhd1212

The product y = Ax of an m × n matrix A times a vector x = (x1, x2, . . . , xn) T can be computed row-wise as y = [A(1,:)*x; A(2,:)*x; ... ;A(m,:)*x]; that is y(1) = A(1,:)*x y(2) = A(2,:)*x ... y(m) = A(m,:)*x Write a function M-file that takes as input a matrix A and a vector x, and as output gives the product y = Ax by row, as defined above (Hint: use a for loop to define each entry of the vector y.) Your M-file should perform a check on the dimensions of the input variables A and x and return a message if the dimensions do not match. Call the file myrowproduct. m. Note that this file will NOT be the same as the myproduct. m example. Test your function on a random 3 × 7 matrix A and a random 7 × 1 vector x. Compare the output with A*x. Repeat with a 2 × 6 matrix and a 6 × 1 vector and with a 2 × 6 matrix and a 1 × 6 vector. Use the command rand to generate the random matrices for testing. Include in your lab report the function M-file and the output obtained by running it.

answer
Answers: 3

Other questions on the subject: Mathematics

image
Mathematics, 21.06.2019 13:00, hihihi129473838
Zoe placed colored blocks on a scale in science class. each block weighed 0.8 ounces. the total weight of all the colored blocks was 12.8 ounces. how many blocks did zoe place on the scale? write and solve an equation to find the answer.
Answers: 2
image
Mathematics, 21.06.2019 23:00, DisneyGirl11
In an equilateral triangle, each angle is represented by 5y+3. what is the value of y? a. 9.7 b. 10.8 c. 11.4 d. 7.2
Answers: 1
image
Mathematics, 22.06.2019 00:30, rayden62
Which image (a’ b’ c’ d’) of abcd cannot he produced using only reflections ?
Answers: 1
image
Mathematics, 22.06.2019 00:30, autumnmeadows20
Officer brimberry wrote 32 tickets for traffic violations last week, but only 4 tickets this week. what is the percent decrease? give your answer to the nearest tenth of a percent.
Answers: 1
Do you know the correct answer?
The product y = Ax of an m × n matrix A times a vector x = (x1, x2, . . . , xn) T can be computed ro...

Questions in other subjects:

Konu
English, 17.09.2021 07:30
Konu
Computers and Technology, 17.09.2021 07:30
Konu
Health, 17.09.2021 07:30