Question: Below is the user defined function matrixMax created as an example in the textbook Chapter 6 ( pages 1 1 1 to 1 1 5

Below is the user defined function matrixMax created as an example in the textbook Chapter 6
(pages 111 to 115). This function finds the largest number in a matrix without using the built-in
function max.
function [biggie]= matrixMax(A)
% user defined function matrixMax
% finds the largest number in a matrix without using the built-in
function max
% Variables
biggie = A(1,1);
rows = size(A,1);
columns = size(A,2);
% Walking the Matrix
for r =1:rows
for c =1:columns
if A(r,c)> biggie % is A(r,c) the largest yet?
biggie = A(r,c);
end
end
end
end
Using good programming practices modify the matrixMax function so that it returns the
minimum value in a matrix and also returns the row and column of the minimum matrix value(s)
as a 1 x 2 row vector. Rename the function as martrixMin. Use the randi function to generate
your test matrix. Submit your solution using the Moodle User Defined Functions with Scripts

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!