2018/09/04

Matlab: Find the arguments of maxima/minima (argmax/argmin) of a vector

The argument of maximum means the index at which the vector/function values is maximized.

Example

>> a = [3 2 1 -2 7]

a =
     3     2     1    -2     7

>> [max_value, argmax] = max(a)

max_value =
     7

argmax =
     5

>> [min_value, argmin] = min(a)

min_value =
    -2

argmin =
     4

>> 

References:

Arg max (Wikipedia)
how do i find argmax? (MathWorks)

沒有留言:

張貼留言