Matrix Multiplication- Old fashioned way 0 solutions submitted (max: Unlimited)
ID: 3709853 • Letter: M
Question
Matrix Multiplication- Old fashioned way 0 solutions submitted (max: Unlimited) In many programming languages, marix multiplication is not available by default and programers need to write their own functions for this operation. This can be acheived by implementing two for loops. Pretend that Matlab does not have matrix mutiplication capability and write a function that takes two confoming matrices as the input and mutiplies the firt one by the xecond one and assigns it to the output Your Function C Reset MATLAB Docu 1 function C MatMultiply (A, B) 3 endExplanation / Answer
function C = MatMultiply(A, B)
[r1, c1] = size(A);
[r2, c2] = size(B);
C = [];
for i=1:r1
for j=1:c2
s = 0;
for k=1:c1
s = s + (A(i, k) * B(k, j));
end
C(i, j) = s;
end
end
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.