27/01/2025
Complex Numbers
▪ A number represented by 𝒛 = 𝑥 + 𝑖𝑦 is a complex number where 𝑥 and 𝑦
are two real numbers and 𝑖 = −1
▪ This representation is defined rectangular form
Imaginary Axis
COMPLEX NUMBERS IN MATLAB ▪ A complex number 𝒛 can be expressed as a vector
z
(x, y)
r
𝒛 = (𝑥, 𝑦) on a plane.
𝑥 = 𝑅𝑒 𝒛 Real Axis
𝑦 = 𝐼𝑚(𝒛)
1 2
Complex Numbers in Polar Form
▪ The Polar Form represents an alternate way to express Complex numbers.
𝑟 = 𝒛 = 𝑎𝑏𝑠 𝒛 = 𝑥2 + 𝑦 2 and
𝑦 Imaginary Axis
𝜃 = ∠ 𝒛 = 𝑎𝑟𝑔 𝒛 = tan −1
𝑥 (x, y)
In matlab, enter the following commands: z
>> z=3-5i ▪ If we have 𝑟 and 𝜃, then 𝑥 and 𝑦 r
are obtained by:
>> real (z)
Real Axis
>> imag(z) 𝑥 = 𝑟𝑐𝑜𝑠𝜃 = 𝑅𝑒 𝒛
>> conj(z) 𝑦 = 𝑟𝑠𝑖𝑛𝜃 = 𝐼𝑚 𝒛
3 4
3 4
1
27/01/2025
Euler’s Formula Representation of Complex Numbers in MATLAB
▪ Complex numbers can be expressed both in rectangular and polar form
▪ Euler's formula, determined by the Swiss Leonhard Euler, establishes a
mathematical relationship between trigonometric functions and the complex • The Rectangular form is described by a simple addition of a real and
exponential function. imaginary part:
𝒛 = 𝑎 + 𝑖𝑏
𝑒𝑖𝜃 = 𝑐𝑜𝑠𝜃 + 𝑖𝑠𝑖𝑛𝜃
▪ Note: Since i in electronics is often used to describe current, some
▪ Therefore, times j is used. In MATLAB, they are equivalent
𝒛 = 𝑟𝑐𝑜𝑠𝜃 + 𝑖𝑟𝑠𝑖𝑛𝜃 = 𝑟(𝑐𝑜𝑠𝜃 + 𝑖𝑠𝑖𝑛𝜃) ▪ The Polar form can be described in terms of Euler’s formula;
𝒛 = 𝑟𝑒𝑖𝜃
𝒛 = 𝑟 ∗ exp(𝑖 ∗ 𝑡ℎ𝑒𝑡𝑎)
▪ Common engineering notation of the polar form:
𝑟𝑒𝑖𝜃 ≡ 𝑟∠𝜃
5 6
5 6
Representation of Complex Numbers in MATLAB Example:
▪ Example: convert the following complex number to polar form.
▪ Example: Convert the following complex number to rectangular form.
𝒛 = 4 + 𝑖3 𝒛 = 4𝑒𝑖2
𝑟= 𝑥2 + 𝑦 2 = 4 2 + 3 2 = 5
3 𝑥 = 4𝑐𝑜𝑠2 = −1.6646 𝑦 = 4𝑠𝑖𝑛2 = 3.6372
𝜃 = tan−1 = 36.87 ° 0.6435 𝑟𝑎𝑑
4
𝒛 = 5∠36.87 ° 𝒛 = −1.6646 + 𝑖3.6372
>> z=4+3i;
▪ In MATLAB:
>> r=abs(z)
r=5 >> z=4*exp(2i)
>> theta_rad=angle(z)
heta_rad=0.6435 z =
>> theta_degree=theta_rad*(180/pi)
theta_degree=36.87
-1.6646 + 3.6372i
>> a=r*exp(i*theta_rad)
a=4.0000 + 3.0000i
7 8
7 8
2