Write a user-defmed function that fmds the largest element of a matrix. For thefunction | StudySoup

Textbook Solutions for MATLAB: An Introduction with Applications

Chapter 7 Problem 28

Question

Write a user-defmed function that fmds the largest element of a matrix. For thefunction name and arguments, use [Em, rc] = matrixmax (A), where A isany size matrix. The output argument Em is the value of the largest element,and rc is a two-element vector with the address of the largest element (rowand column numbers). If there are two, or more, elements that have the maximumvalue, the output argument rc is a two-column matrix where the rowslist the addresses of the elements. Test the function three times. For input createa 4 x 6 matrix using the following command: x=randi ( [- 2 0100] ,4,6)

Solution

Step 1 of 5)

The first step in solving 7 problem number 28 trying to solve the problem we have to refer to the textbook question: Write a user-defmed function that fmds the largest element of a matrix. For thefunction name and arguments, use [Em, rc] = matrixmax (A), where A isany size matrix. The output argument Em is the value of the largest element,and rc is a two-element vector with the address of the largest element (rowand column numbers). If there are two, or more, elements that have the maximumvalue, the output argument rc is a two-column matrix where the rowslist the addresses of the elements. Test the function three times. For input createa 4 x 6 matrix using the following command: x=randi ( [- 2 0100] ,4,6)
From the textbook chapter User-Defined Functions and Function Files you will find a few key concepts needed to solve this.

Step 2 of 7)

Visible to paid subscribers only

Step 3 of 7)

Visible to paid subscribers only

Subscribe to view the
full solution

Title MATLAB: An Introduction with Applications 5 
Author Amos Gilat
ISBN 9781118629864

Write a user-defmed function that fmds the largest element of a matrix. For thefunction

Chapter 7 textbook questions

×

Login

Organize all study tools for free

Or continue with
×

Register

Sign up for access to all content on our site!

Or continue with

Or login if you already have an account

×

Reset password

If you have an active account we’ll send you an e-mail for password recovery

Or login if you have your password back