Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The product y = A x of an m n matrix A times a vector x = ( x 1 , x 2 , dots,
The product of an matrix A times a vector dots, can be
computed rowwise as
:;:;dots;:;
that is
:
:
cdots
:
Write a function Mfile that takes as input a matrix A and a vector and as output gives
the product by row, as defined above Hint: use a for loop to define each entry of
the vector
Your Mfile should perform a check on the dimensions of the input variables A and 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 matrix A and a random vector Compare the
output with
Repeat with a matrix and a vector and with a matrix and a vector.
Use the command rand to generate the random matrices for testing.
Include in your lab report the function Mfile and the output obtained by running it
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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