Matlab functions    from  BioméCardio    

 
   idctn
imin   

imax

Interpolated largest elements in array

Contents

Download

imax.m

Syntax

   Y = imax(X)
   Y = imax(X,[],dim)
   [Y,I] = imax(...)

Description

Works as max except that interpolations are performed on three consecutive points to provide a (likely) more realistic maximum.

For vectors, imax(X) is the largest interpolated element in X. For matrices, imax(X) is a row vector containing the interpolated maximum element from each column. For N-D arrays, imax(X) operates along the first non-singleton dimension.

[Y,I] = imax(X) returns the locations of the interpolated maximum values in a floating-point array I. For example, I = 1.5 means that the interpolated maximum is located at the middle of the [1,2] segment. If the values along the first non-singleton dimension contain more than one interpolated maximal element, the index of the first one is returned.

[Y,I] = imax(X,[],dim) operates along the dimension dim.

imax(X,Y) does not interpolate and makes the same as max(X,Y). It returns an array the same size as X and Y with the largest elements taken from X or Y. Either one can be a scalar.

When X is complex, imax does not interpolate and makes the same as max. The maximum is computed using the magnitude max(abs(X)). In the case of equal magnitude elements, then the phase angle max(angle(X)) is used.

NaNs are ignored when computing the interpolated maximum. When all elements in X are NaNs, then the first one is returned as the interpolated maximum.

Notes: The interpolations are performed using parabolas on three consecutive points.

Examples

Calculate the interpolated maxima along the columns

x = [2 8 4;7 3 9];
imax(x,[],2)
ans =

    8.0500
    9.0000

Compare imax with max

x = [0 64 96 96 64 0];
[z,I] = max(x)
z =

    96


I =

     3

[z,I] = imax(x)
z =

   100


I =

    3.5000

imax

See also

max, imin

About the author

Damien Garcia, Eng., Ph.D.
Assistant professor, Department of radiology
CRCHUM, University of Montreal Hospital
Montreal, QC, Canada
Damien.Garcia.REMOVE-THIS@biomecardio.com

www.biomecardio.com