I'm not sure which MATLAB command performs the same operation as this. Could you please help?
EXERCISE 2 (3 points)
Difficulty: Easy
DESCRIPTION: In this exercise, you will create a function in a MATLAB file (see Project 0) using the given code and run the function on the given matrices.
The function takes two matrices A and B as inputs and returns a single matrix C if the dimensions of A and B agree; otherwise, it returns an empty matrix, C = [].
function C = trial(A, B)
[m, p] = size(A);
[q, n] = size(B);
if p == q
C = zeros(m, n);
for i = 1:n
C(:, i) = A * B(:, i);
end
else
C = [];
disp('The dimensions of A and B disagree');
end
end
**Create the function trial in a file in MATLAB.
**Type the created function in the diary file.
**Run the function C = trial(A, B) on the matrices given below to get the output C:
a) A = randi(10, 3, 5), B = ones(3, 5)
b) A = magic(4), B = ones(4, 3)
c) A = magic(5), B = ones(5)
**Write a single MATLAB command that performs the same operation on matrices A and B as the function above. Execute it in your diary file on the given matrices. You may receive an error message from MATLAB if the dimensions of the matrices do not match - do not delete it from your diary file.
%Compare the outputs after executing the function and the single command and write a comment whether they match or not.
%Write a comment on the form of the outputs for parts (b) and (c) (take into consideration the properties of the matrix magic)