1、complex函数:创建复数
2、用法说明:
(1)z = complex(x,y) 函数创建复数z,输入的x,y必须同为变量或维数相同、相同数据类型的向量、矩阵或者多维数组。输出的结果跟输入的维数相同,返回值为a+b*i;
(2)y=complex(x) 返回结果为实部为x,所有虚部为0的复数,等价于y=complex(x,0)。
3、实例
>> x = complex(24,56)
x =
24.0000 +56.0000i
>> x = complex(3:7,6:9)
Error using complex
Input arrays must have the same size.
>> x = complex(3:7,1:5)
x =
3.0000 + 1.0000i 4.0000 + 2.0000i 5.0000 + 3.0000i 6.0000 + 4.0000i 7.0000 + 5.0000i
>> x = complex(rand(3,4),rand(3,4))
x =
0.1622 + 0.2290i 0.5285 + 0.8258i 0.2630 + 0.0782i 0.7482 + 0.9619i
0.7943 + 0.9133i 0.1656 + 0.5383i 0.6541 + 0.4427i 0.4505 + 0.0046i
0.3112 + 0.1524i 0.6020 + 0.9961i 0.6892 + 0.1067i 0.0838 + 0.7749i