GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • » Octave core
  • » by package
  • » alphabetical

This view

  • Original page
  • New address

GeezerVison is showing octave.sourceforge.io — Function Reference: max

Octave-Forge - Extra packages for GNU Octave
Home · Packages · Developers · Documentation · FAQ · Bugs · Mailing Lists · Links · Code

Navigation

Operators and Keywords

Function List:

  • » Octave core
  • » by package
  • » alphabetical

C++ API

: max (x)
: max (x, [], dim)
: [w, iw] = max (x)
: max (x, y)

Find maximum values in the array x.

For a vector argument, return the maximum value. For a matrix argument, return a row vector with the maximum value of each column. For a multi-dimensional array, max operates along the first non-singleton dimension.

If the optional third argument dim is present then operate along this dimension. In this case the second argument is ignored and should be set to the empty matrix.

For two matrices (or a matrix and a scalar), return the pairwise maximum.

Thus,

max (max (x))

returns the largest element of the 2-D matrix x, and

max (2:5, pi)
   ⇒  3.1416  3.1416  4.0000  5.0000

compares each element of the range 2:5 with pi, and returns a row vector of the maximum values.

For complex arguments, the magnitude of the elements are used for comparison. If the magnitudes are identical, then the results are ordered by phase angle in the range (-pi, pi]. Hence,

max ([-1 i 1 -i])
   ⇒ -1

because all entries have magnitude 1, but -1 has the largest phase angle with value pi.

If called with one input and two output arguments, max also returns the first index of the maximum value(s). Thus,

[x, ix] = max ([1, 3, 5, 2, 5])
   ⇒  x = 5
       ix = 3

See also: min, cummax, cummin.

Package: octave

SourceForge.net Logo
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.