# Multiply matrix (nxm) by vector (m)

35 views (last 30 days)
Diego Rey on 8 Oct 2020 at 13:23
Commented: Steven Lord on 8 Oct 2020 at 15:04
Hello,
I need to do a exercise where I have a matrix A of size nxm, a matrix B of size m x p and a column vector x of length m. I am asked to:
a) Write a function "y = MatVecProduct(A, x)" to find y as the product of A and x using this operation:
yi = Summatory from k=1 to m of Aik * xj for all i = 1, ..., n
Then I need to run it on matlab with any vector of dimensions n = 3 and m = 4 and check the operation.
b) Write a function "C = MatMatProduct(A, B)" to find C as the product of A and B using thiis operation:
Cij = Summatory from k=1 to m of Aik * Bkj for all i= 1,...,n and for all j=1,...,p
Then run it on matlab with any matrices of dimensions n=3 and m=p=4.

Star Strider on 8 Oct 2020 at 13:31
You have our permission!
Diego Rey on 8 Oct 2020 at 13:39
Ok man thanks...
Steven Lord on 8 Oct 2020 at 15:04
Since this is a homework assignment, if you show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.