Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
指定された値をテストする方法はinfinity、-infinityまたはNaN. isinf「double」に対してのみ機能し、値をテストすることはできませんNaN。
infinity
-infinity
NaN.
isinf
NaN
試してみてくださいisfinite。例えば:
isfinite
isfinite([0 1 2 inf -inf nan]) ans = 1 1 1 0 0 0
使用できますisinf(x) | isnan(x)。
isinf(x) | isnan(x)
は要素単位|の論理orです。したがって、上記のコマンドは、要素が ±またはの場合は各要素に対して true に変換され、それ以外の場合は falsexInfNaNに変換されます。
|
x
Inf