# complex

Creating complex array

### complex(A,B)

• It returns an array of complex numbers, whose real and imaginary parts are taken from A and B, respectively.
• Arrays A and B should have the same sizes, or one of them should be a scalar. In the latter case, the scalar argument is expanded to a constant array to match the size of the other argument.
• Both A and B should be real.
• It gives the same result as A + B * 1i.

Example 1: Plotting phase angles for various complex numbers.

x=-100:100;
[X,Y]=meshgrid(x);
Z=angle(complex(X,Y));
surf(X,Y,Z)
xlabel('x');
ylabel('y');
zlabel('angle(complex(x,y))')

Surface plot is generated.