 # Question & Answer: D Assignment-5(2).pdf ← → c Secure Apps G Google × e Please Doln MATLAB I ( × https: app.lms unimelb.edu.au/bbcsw…..  Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: D Assignment-5(2).pdf ← → c Secure Apps G Google × e Please Doln MATLAB I ( × https: app.lms unimelb.edu.au/bbcsw…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS \$13/PAGE

D Assignment-5(2).pdf ← → c Secure Apps G Google × e Please Doln MATLAB I ( × https: app.lms unimelb.edu.au/bbcswebdav/pid-5834079-dt content rid-24294143 2/courses/ENGR10003 2017 SM2/Assignment 596282%29.pdf 5 1 7 Question3 [15 Marks Write a function computeMatrixMax that will take a matrix as input, and return the maximum values of each row (as a vector) and the maximum value of the entire matrix. Following is the function signature. function [row-max matrix-max) computeMatrixMax(A) = Input: A – a is a matrix (the size is arbitrary) Outputs: rowmax-a vector that contains the maximu value of each row – matrix_max – the maximum value of the matrix For example if, then the function should return: 9.58 PM 14/09/2017 Type here to search ^回脈

Provided Matlab code done as per your requirements.

• Screen shot program code” for better understanding.
• Code to copy” to run the code in IDE.

Screen shot program code:  Code to copy:

%Input A-a is a matrix (the size is arbitrary)
A= [ 1 6 5;2 4 7]

%Call the function
[row_max, matrix_max] =computeMatrixMax(A);
%Outputs: row_max – a vector that contains the maximum value of each row
disp(‘Matrix’);
disp(A);
disp(‘row_max’);
disp(row_max);
disp(‘matrix_max’);
disp(matrix_max);

%Function definition of computeMatrixMax: It accepts a matrix
%as input, and return the maximum values of each row and the
%entire matrix

function [row_max, matrix_max ] = computeMatrixMax( A )
[rows, columns] = size(A);
row_max=size(rows);
for i = 1:rows
row_max(i) = A(i,1);
for j = 1: columns
if A(i,j) > row_max
row_max(i) = A(i,j);
end
end
matrix_max = A(1,1);
for p = 2:numel(A)
if A(p) > matrix_max
matrix_max = A(p);
end
end
end