主要内容

inf

Create array of allinf

Description

X = Infreturns the scalar representation of positive infinity. Operations returninfwhen their result is too large to represent as a floating point number, such as1/0或者log(0)

For double-precision,inf代表大于Realmax。对于单精制,inf代表大于REALMAX('单')

example

x = inf(n)返回n-经过-nmatrix ofinf值。

example

x = inf(SZ1,...,SZN)返回sz1-经过-。。。-经过-szN大批ofinf值, whereSZ1,...,SZNindicate the size of each dimension. For example,INF(3,4)returns a 3-by-4 matrix.

example

x = inf(sz)返回一系列inf值, where the size vectorszdefinessize(X)。For example,inf([3 4])returns a 3-by-4 matrix.

example

x = inf(___,打字)返回一系列inf数据类型的值打字,这可以是'single'或者'double'

example

x = inf(___,'喜欢',p)返回一系列inf值of the same data type, sparsity, and complexity (real or complex) asp。You can specify打字或者'like'但不是两者。

Examples

collapse all

创建一个3 x-3的矩阵inf值。

x = inf(3)
X =3×3infinfinfinfinfinfinfinfinf

创建一个2 x-3 x-4的阵列inf值并显示其大小。

x = inf(2,3,4); size(X)
ans =1×32 3 4

Create an array ofinf值that is the same size as an existing array.

A = [1 4; 2 5; 3 6]; sz = size(A); X = Inf(sz)
X =3×2infinfinfinfinfinf

将前两行代码组合到单行中是一种常见模式。

x = inf(size(A));

Create a 1-by-3 vector ofinf值whose elements are of typesingle

x = inf(1,3,'single')
X =1x3 single row vectorinfinfinf

您也可以指定the output type based on the type of another variable. Create a variablepof typesingle。Then, create a vector ofinf值with the same size and type asp

p =单个([1 2 3]);x = inf(size(p),'like',p)
X =1x3 single row vectorinfinfinf

Input Arguments

collapse all

方形矩阵的大小,指定为整数。

  • Ifn是0,然后Xis an empty matrix.

  • Ifnis negative, then it is treated as 0.

Data Types:double|single|int8|INT16|INT32|int64|uint8|UINT16|uint32|uint64

Size of each dimension in a list, specified as separate integer arguments.

  • If the size of any dimension is 0, thenXis an empty array.

  • If the size of any dimension is negative, then it is treated as 0.

  • Beyond the second dimension,infignores trailing dimensions of length 1. For example,inf(3,1,1)creates a 3-by-1 vector ofinf值。

Data Types:double|single|int8|INT16|INT32|int64|uint8|UINT16|uint32|uint64

Size of each dimension in a vector, specified as a row vector of integers.

  • If the size of any dimension is 0, thenXis an empty array.

  • If the size of any dimension is negative, then it is treated as 0.

  • Beyond the second dimension,infignores trailing dimensions of length 1. For example,INF([3 1])creates a 3-by-1 vector ofinf值。

Data Types:double|single|int8|INT16|INT32|int64|uint8|UINT16|uint32|uint64

数据类型来创建、specified as'double'或者'single'

数组的原型要创建,指定为数组。

Data Types:double|single
Complex Number Support:Yes

Extended Capabilities

Version History

在R2006a之前引入