Answer:
See explaination for the details.
Explanation:
% Matlab file calculateMirrorMatrix.m
% Matlab function to return a matrix which should be input matrix mirrored
% on the vertical axis
% input is a matrix
% output is a matrix of same size as input matrix
function [mirrorMatrix] = calculateMirrorMatrix(inputMatrix)
mirrorMatrix = zeros(size(inputMatrix)); % create output matrix mirrorMatrix of same size as inputMatrix
fprintf('\n Input Matrix :\n');
disp(inputMatrix); % display the input matrix
[row,col] = size(inputMatrix); % row, col contains number of rows and columns of the inputMatrix
% loop to find the matrix which should be input matrix mirrored
for i = 1:row
mirrorIndex =1;
for j = col:-1:1
mirrorMatrix(i,mirrorIndex)=inputMatrix(i,j);
mirrorIndex=mirrorIndex + 1;
end
end
end
% end of matlab function
Please kindly check attachment for its output.