Section: Array Generation and Manipulations
NaN
function.
The first form returns a double precision NaN
.
y = nan
The next form takes a class name that can be either 'double'
y = nan('double')
or 'single'
:
y = nan('single')
With a single parameter it generates a square matrix of nan
s.
y = nan(n)
Alternatively, you can specify the dimensions of the array via
y = nan(m,n,p,...)
or
y = nan([m,n,p,...])
Finally, you can add a classname of either 'single'
or 'double'
.
--> nan*0 ans = NaN --> nan-nan ans = NaN
Note that NaN
s are preserved under type conversion to floating point types (i.e., float
, double
, complex
and dcomplex
types), but not integer types.
--> uint32(nan) ans = 0 --> complex(nan) ans = NaN