0% found this document useful (0 votes)
81 views

Complex Numbers in Matlab

A number represented by z=x+iy  is a complex number where x and y are two real numbers and i=√−1

Uploaded by

Nurullah Mertel
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views

Complex Numbers in Matlab

A number represented by z=x+iy  is a complex number where x and y are two real numbers and i=√−1

Uploaded by

Nurullah Mertel
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

COMPLEX NUMBERS IN MATLAB

Programming with Matlab


Calendar

Unit What
1 Introduction to MATLAB
2 Flow control & Data Structures
3 Plotting
4 Strings & File IO
5 Complex Numbers
6 Combinatorics
7 Linear Algebra
8 Statistics & Data Analysis
9 Polynomial Approximation,
Curve Fitting
10 Root Finding, Numerical
Differentiation
11 Numerical Integration
12 MATLAB GUI

2
Complex Numbers

 A number represented byis a complex number where and are two real
numbers and
 This representation is defined rectangular form

Imaginary Axis

( x, y )
 A complex number can be expressed as a vector
z
on a plane. r


Real Axis

3
Complex Numbers in Polar Form

 The Polar Form represents an alternate way to express Complex numbers.

and

Imaginary Axis

( x, y )
 If we have and then and z
are obtained by: r

= 
Real Axis

4
Euler’s Formula

 Euler's formula, determined by the Swiss Leonhard Euler, establishes a


mathematical relationship between trigonometric functions and the complex
exponential function.

 Therefore,

 Common engineering notation of the polar form:

5
Representation of Complex Numbers in MATLAB

 Complex numbers can be expressed both in rectangular and polar form

• The Rectangular form is described by a simple addition of a real and


imaginary part:

 Note: Since i in electronics is often used to describe current, some


times j is used. In MATLAB, they are equivalent

 The Polar form can be described in terms of Euler’s formula;

6
Representation of Complex Numbers in MATLAB

 Example: convert the following complex number to polar form.

>> z=4+3i;
>> r=abs(z)
r=5
>> thetaRad=angle(z)
thetaRad=0.6435
>> thetaDegree=thetaRad*(180/pi)
thetaDegree=36.87
>> a=r*exp(i*thetaRad)
a=4.0000 + 3.0000i

7
Example:

 Example: Convert the following complex number to rectangular form.

 In MATLAB:
>> z=4*exp(2i)

z =

-1.6646 + 3.6372i

8
Operations on Complex Numbers: SUM

• The addition or subtraction of two complex number is a Vector Sum

Imaginary Axis

z2
z sum
z1

z2
Real Axis

9
Operations on Complex Numbers: Complex Conjugate

 Let ,

 We define the complex conjugate of , denoted by :

 Note: The product of and :

• Note(2):

10
Operations on Complex Numbers: Multiplication

 Multiplication in Rectangular Form:

;
𝒛 𝑝𝑟𝑜𝑑=𝑥 1 𝑥 2 − 𝑦 1 𝑦 2 +𝑖(𝑥 1 𝑦 2+𝑥 2 𝑦 1)

 The operation require calculations that can be costly or cumbersome. If


we move the representation to Polar Form:

11
Operations on Complex Numbers: Division

 Division in rectangular form:

• Again, this operation is not suited to the rectangular form, where it can be costly
or cumbersome. If we move to the polar representation
; ;

12
Application of Complex Numbers

Why would we want to use complex numbers?

• Complex numbers are used as a Tool to simplify computation in


different fields. The main reason for their vast utilization is due to their
application to Electronics and AC currents, but they are very useful also
in other environments

13
Application of complex numbers in algebra

 For deriving some equalities in Algebra, complex numbers help:

 Example calculate the integral:

14
Application of complex numbers (1)

 For deriving some equalities in Algebra, complex numbers help:

 Example calculate the integral:

15
Application of Complex numbers (2)

 Determine the roots of In MATLAB: >>roots([1 0 0 0 1])

𝜋 2𝜋
𝑖( +𝑛 )
4 4
𝑠=𝑒
𝜋
𝑖
4
𝑠 1=𝑒 = 0.7071+𝑖 0.7071
3𝜋
𝑖
4
𝑠 2= 𝑒 =−0.7071+𝑖 0.7071
5𝜋
𝑖
4
𝑠 3 =𝑒 =−0.7071 −𝑖 0.7071
7𝜋
𝑖
4
𝑠 4 =𝑒 = 0.7071−𝑖 0.7071

16
Application of Complex Numbers (3)

In physics and engineering, a phase vector, or phasor, is a complex number


representation of a sinusoidal function with fixed frequency, and whose
amplitude (A) and phase (θ) are time-invariant.
A typical example is Alternating Current (AC):
Amplitude=A

Any such waveform can be represented


by a vector in the complex field

Phase= θ

Source:www.wikipedia.org

17
Application of Complex Numbers: Example

 Let's connect three AC voltage sources in series and use complex


numbers in MATLAB to determine additive voltages:

E1 E2 E3

 Graphically, the vectors add up as shown: 


>> E1=12*(cos((-42/180)*pi)+ i*sin((-42/180)*pi))
8.9177 - 8.0296i
>> E2=9*(cos((69/180)*pi)+i*sin((8/180)*pi))
3.2253 + 1.2526i
>> E3=0+i*10
>> ETotal=E1+E2+E3= 12.1430 + 3.2230i
>> abs(ETotal)= 12.5635
>> (180*angle(ETotal))/pi= 14.8646

18

You might also like