Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions