Complex numbers consist of two separate parts: a real part and an imaginary part. The basic imaginary unit is equal to the square root of
-1. This is represented in MATLAB by either of two letters:
Creating Complex Numbers
The following statement shows one way of creating a complex value in MATLAB. The variable
x is assigned a complex number with a real part of
2 and an imaginary part of
Another way to create a complex number is using the
complex function. This function combines two numeric inputs into a complex output, making the first input real and the second imaginary:
You can separate a complex number into its real and imaginary parts using the
Complex Number Functions
See Complex Number Functions for a list of functions most commonly used with MATLAB complex numbers in MATLAB.
|Floating-Point Numbers||Infinity and NaN|
© 1994-2005 The MathWorks, Inc.