In: Physics
Since the given question asked for matrix multiplication, I assume that you aren't allowed to use direct '*' operation which can do matrix multiplication directly in MATLAb. So, please find the required MATLAB code below:
clear all; clc; close all;
A=[2 3 5; 4 5 4]; % m*n dimension matrix
x=[4;5;6]; % n*1 dimesion matrix
B=[2 6; 3 6; 4 6]; % n*k dimenion matrix
%% PROBLEM 1
[m,n]=size(A);
[k,l]=size(x);
disp('Solving Problem 1:')
Y=zeros(m,1);
for i=1:m
for j=1:l
for p=1:n
flag=1;
Y(i,j)=Y(i,j)+ A(i,p)*x(p,j);
end
end
end
disp(Y)
%% PROBLEM 2
disp('Solving Problem 2:')
[m,n]=size(A);
[k,l]=size(B);
C=zeros(m,l);
for i=1:m
for j=1:l
for p=1:n
flag=1;
C(i,j)=C(i,j)+ A(i,p)*B(p,j);
end
end
end
disp(C)
========================== SCREENSHOT OF CODE