Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(MATLAB) There's built-in max function, for determining themaximum of a vector of elements. The function is more general,including the following two features. In addition to

(MATLAB) There's built-in max function, for determining themaximum of a vector of elements. The function is more general,including the following two features.

In addition to returning the value of the maximum, it canproduce a second output argument that is the index ofwhere that maximum occurred. The calling syntax is

[Y I] = max(X);     

where Y is the actual maximum and I is the index at which itoccurs. In the special case where there is a tie for the maximum,the index will be that of the first occurrence.
While the standard behavior applies on row vectors and columnvectors, the max(X) function has a slightly different behavior whenX is a matrix. It computes the maximum value and occurring index ona column-by-column basis. For example, when run on the followingmatrix

5 3 11

3 9 3

8 9 8

12 2 10

The first output argument is the vector of column-maximums

12 9 11

and the second output is the corresponding vector of indices

Your goal for this problem is to write your own version of thisfunction titled myMax. You are to ensure that it works preciselylike the official max function on both one-dimensional vectors andtwo-dimensional arrays

4 2 1.

Step by Step Solution

3.47 Rating (160 Votes )

There are 3 Steps involved in it

Step: 1

To implement your own version of the max function in MATLAB you can follow these steps Define a func... 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

Intermediate Microeconomics and Its Application

Authors: walter nicholson, christopher snyder

11th edition

9781111784300, 324599102, 1111784302, 978-0324599107

More Books

Students also viewed these Programming questions

Question

why is AIS important to a JIT system?

Answered: 1 week ago