Question

1. (20pts) Write the MATLAB program to find the multiplication of [B][A] MATLABs matrix operation capabilities.. .you must c
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Explanation :
As matrix capabilities of MATLAB are not allowed to be used, we will first locate the member in result matrix being calculated, and then for that member, we will do element wise multiplication of B and A.

Suppose (1,1) element of resultant matrix is to be calculated, we know that (1,1) will be element-wise multiplication of first row of B and first column of A. So we will run loop where each member of 1st row of B is multiplied with corresponding element from 1st column of A. For reference, look for loop controlled by variable k in the below code. Location of resultant member is fixed by i and j variable controlled loop.

MATLAB Code:

clear all
%Clearing preivious data

clc
%Clearing screen

A = [4 5; 1 2; 5 6];
B = [4 3 7; 1 2 6; 2 0 4];
%Defining Matrices

[Ra,Ca]=size(A);
[Rb,Cb]=size(B);
%Identifying rows and columns in A and B matrices

%First locating which member we are going to calculate
for i=1:Rb
for j=1:Ca
  
%Initiating the member in multiplication result matrix with 0
M(i,j) = 0;
  
%Doing one by one element multiplication
for k=1:Rb;
  
%Adding each new element's multiplication to member
M(i,j) = M(i,j)+ B(i,k)*A(k,j);
end
end
end

%Displaying results
disp('Resultant Matrix : ');
disp(M)

Output in Command Window:

Command Window Resultant Matrix : 54 68 36 45 28 34

Add a comment
Know the answer?
Add Answer to:
1. (20pts) Write the MATLAB program to find the multiplication of [B][A] MATLAB's matrix operation capabilities.....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT