Complex number determination

44 ビュー (過去 30 日間)
iael
iael 2012 年 1 月 3 日
How can I check if a number is imaginary? I want to set an if function, that if a variable is an aimginary number then something will happen.

採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 1 月 3 日
z - your number
out = imag(z) ~= 0;
if out = true, then z - complex number
OR
out = isreal(z)
if out = false, then z - complex number

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by