Multiply matrix (nxm) by vector (m)
1 view (last 30 days)
Show older comments
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.
Thank you in advance.
3 Comments
Steven Lord
on 8 Oct 2020
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.
Answers (0)
See Also
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!