MATLAB中的NaN表示什么

Not a Number不是一个数

a 除数是一个数列,数列第一项为0
b 被除数也是一个数列,数列第一项为0
c=a./b
这样除出来的结果,c的第一项是NaN
我想问下这种情况应该怎么处理?
如果我想要相除的结果第一项为零,我该怎么整?

解决办法,给NaN赋值0

NaN就是Not a Number
0/0, ∞/ ∞, 0× ∞等运算都会产生NaN
Matlab用NAN来真实记录0/0, ∞/ ∞, 0× ∞等运算的后果,避免可能因上述计算而造成的程序执行的中断。

NaN    Not-a-Number.
    NaN is the IEEE arithmetic representation for Not-a-Number.
    A NaN is obtained as a result of mathematically undefined
    operations like 0.0/0.0  and inf-inf.

    NaN('double') is the same as NaN with no inputs.

    NaN('single') is the single precision representation of NaN.

    NaN(N) is an N-by-N matrix of NaNs.

    NaN(M,N) or NaN([M,N]) is an M-by-N matrix of NaNs.

    NaN(M,N,P,...) or NaN([M,N,P,...]) is an M-by-N-by-P-by-... array of NaNs.

    NaN(...,CLASSNAME) is an array of NaNs of class specified by CLASSNAME.
    CLASSNAME must be either 'single' or 'double'.