Engee documentation

min

The minimum elements of the array.

Library

EngeeDSP

Syntax

Function call

  • M = min(A) — returns the minimum elements of the array.

    • If A — vector, then min(A) returns the minimum value A.

    • If A — the matrix, then min(A) — vector-a row containing the minimum value of each column A.

    • If A — a multidimensional array, then min(A) it operates on the first dimension A, the size of which is not equal to 1 considering the elements as vectors. Size M in this dimension , it becomes equal to 1, while the dimensions of all other dimensions remain the same as in A. If A — an empty array, the first dimension of which has zero length, then M — an empty array of the same size as A.

  • M = min(A, [], "all") — returns the minimum for all elements A.

  • M = min(A, [], dim) — returns the minimum element by dimension dim. For example, if A — the matrix, then min(A,[],2) returns a column vector containing the minimum value of each row.

  • M = min(A, [], vecdim) — returns the minimum of the dimension specified in the vector vecdim. For example, if A — the matrix, then min(A,[],[1 2]) returns the minimum for all elements of the matrix A since each element of the matrix is contained in an array layer defined by the dimensions 1 and 2.

  • M = min(A, [], _, missingflag) — also specifies how to handle missing values for any of the previous syntax options. For example, min(A,[],"includenan") includes all missing values when calculating the minimum. By default min excludes missing values.

  • M, I = min(_) — also returns the index in the working dimension corresponding to the first occurrence of the minimum value. A.

  • M, I = min(A, [], _, "linear") — also returns a linear index in A corresponding to the minimum value in A.

  • C = min(A, B) — returns an array with the smallest elements taken from A or B.

  • C = min(A, B, missingflag) — also specifies how to handle missing values.

  • _ = min(_, "ComparisonMethod",method) — also specifies a way to compare elements for any of the previous syntax options. For example, for a vector A = [-1 2 -9] syntax min(A,[],"ComparisonMethod","abs") compares A elements by their absolute values and returns the minimum value -1.

Arguments

Input arguments

# A — input data

+ scalar | vector | the matrix | multidimensional array

Details

Input data specified as a scalar, vector, matrix, or multidimensional array.

  • If A is a complex number, then min(A) returns the complex number with the smallest absolute value. If the values are equal, then min(A) returns the value with the smallest absolute value and the smallest phase angle.

  • If A — a scalar, then min(A) returns A.

  • If A — an empty array of size 0 on 0 Then min(A) it will also be an empty array.

Типы данных

Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool

Support for complex numbers

Yes

# dim — the measurement for which the operation is performed

+ scalar

Details

The dimension that the operation is performed on, specified as a positive integer scalar. If no dimension is specified, then the first dimension of the array is used by default, the size of which is not equal to 1.

Dimension dim specifies a dimension whose length is reduced to 1. Size size(M, dim) equal to 1 while the dimensions of all other dimensions remain the same, unless size(A, dim) not equal to 0. If size(A, dim) equal to 0, then the function min(A, dim) returns an empty array of the same size as A.

Consider the input matrix A size on :

  • min(A,[],1) calculates the minimum of elements in each column of the matrix A and returns a vector string of the size 1 on .

min 1

  • min(A,[],2) calculates the minimum of elements in each row of the matrix A and returns a column vector of size 1 on .

min 2

# vecdim — measurement vector

+ vector

Details

A vector of dimensions defined as a vector of positive integers. Each element represents a dimension of the input array. The length of the output data in the specified operating measurements is 1, while the other dimensions remain unchanged.

Consider the input array A size 2×3×3. Then std(A,0,[1 2]) returns an array of size 1×1×3, the elements of which are the minimum values calculated for each layer A.

std 3 en

# missingflag — condition for missing a value

+ "omitnan" (by default) | "includenan"

Details

The condition for missing a value, set as:

  • "includenan" — takes into account missing values in the input data. If any element is missing in the working dimension, then the corresponding element in the M also missing;

  • "omitnan" — ignores missing values in the input data and calculates the minimum from a smaller number of points. If all the elements in the working dimension are missing, then the corresponding elements in M also missing.

# B — additional input data

+ scalar | vector | the matrix | multidimensional array

Details

Additional input data, specified as a scalar, vector, matrix, or multidimensional array. Input data A and B they must be the same size or have compatible sizes (for example, A — matrix size on , and B — a scalar or vector string of the size 1 on ).

  • If A and B — arrays, then they must have the same data type, except when one of them is a type Float64. In this case, the data type of the other array may be Float32 or any integer type.

Типы данных

Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool

Support for complex numbers

Yes

# method — comparison method

+ "auto" (default) | "real" | "abs"

Details

The comparison method for the input data, specified by one of the following values:

  • "auto" — for A compare elements by value real(A) if A a real number, and by value abs(A) if A comprehensive;

  • "real" — for A compare elements by value real(A) if A real or complex. If the elements A if they have equal real parts, then the function is used to resolve the matches imag(A);

  • "abs" — for A compare elements by value abs(A) if A real or complex. If the elements A if they have equal absolute values, then the function is used to resolve the matches angle(A) in the interval .

Output arguments

# M — minimum values

+ scalar | vector | the matrix | multidimensional array

Details

The minimum values returned as a scalar, vector, matrix, or multidimensional array. Size size(M,dim) equal to 1, while the dimensions of all other dimensions match the size of the corresponding dimension in A if size(A,dim) not equal to 0. If size(A,dim) equal to 0 Then M — an empty array of the same size as A.

# I — index

+ scalar | vector | the matrix | multidimensional array

Details

An index returned as a scalar, vector, matrix, or multidimensional array. Argument I it has the same size as the first output parameter.

If the call does not specify "linear" Then I — this is the index of the working measurement. If the call specifies "linear" Then I contains linear indexes A corresponding to the minimum values.

If the smallest element occurs more than once, then I contains the index of the first occurrence of the value.

# C — minimum elements from A or B
scalar | vector | the matrix | multidimensional array

Details

Minimal elements from A or B returned as a scalar, vector, matrix, or multidimensional array. Size C it is determined by the implicit expansion of dimensions A and B.

Data type C depends on the data types A or B:

  • If A and B have the same data type, then C corresponds to the data type A and B;

  • If A or B has a type Float32 Then C It also has a type Float32;

  • If one of the A or B has an integer type, and the other is a type Float64 Then C it has an integer type.

Examples

Minimum element of a real vector

Details

Let’s create a vector and find the minimum element and its index.

import EngeeDSP.Functions: min

A = [23, 42, 37, 15, 52]
M = min(A)
(M = 15, I = 4)

The minimum element of a complex vector

Details

Let’s create a complex vector and find the minimum element and its index.

import EngeeDSP.Functions: min

A = [-2+2im, 4+1im, -1-3im]
M = min(A)
(M = -2 + 2im, I = 1)