imin
Interpolated smallest elements in array
Contents
Download
Syntax
Y = imin(X) Y = imin(X,[],dim) [Y,I] = imin(...)
Description
Works as min except that interpolations are performed on three consecutive points to provide a (likely) more realistic minimum.
For vectors, imin(X) is the smallest interpolated element in X. For matrices, imin(X) is a row vector containing the interpolated minimum element from each column. For N-D arrays, imin(X) operates along the first non-singleton dimension.
[Y,I] = imin(X) returns the locations of the interpolated minimum values in a floating-point array I. For example, I = 1.5 means that the interpolated minimum is located at the middle of the [1,2] segment. If the values along the first non-singleton dimension contain more than one interpolated minimal element, the index of the first one is returned.
[Y,I] = imin(X,[],dim) operates along the dimension dim.
imin(X,Y) does not interpolate and makes the same as min(X,Y). It returns an array the same size as X and Y with the smallest elements taken from X or Y. Either one can be a scalar.
When X is complex, imin does not interpolate and makes the same as min. The minimum is computed using the magnitude min(abs(X)). In the case of equal magnitude elements, then the phase angle min(angle(X)) is used.
NaN's are ignored when computing the interpolated minimum. When all elements in X are NaN's, then the first one is returned as the interpolated minimum.
Notes: The interpolations are performed using parabolas on three consecutive points.
Examples
Calculate the interpolated minima along the columns
x = [2 8 4;7 3 9]; imin(x,[],2)
ans =
2.0000
2.9500
Compare imin with min
x = [100 36 4 4 36 100]; [z,I] = min(x)
z =
4
I =
3
[z,I] = imin(x)
z =
0
I =
3.5000
See also
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