Complex number determination

42 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Logical 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by