EcE 224 Lab Act 1
EcE 224 Lab Act 1
EcE 224 Lab Act 1
Complex Numbers
𝑓(𝑥) = 𝑥 2 + 2𝑥 − 1
If you try to solve this with the same rules in elementary algebra that we are familiar
with, it would be proved difficult and seems to have no correct answer. So,
mathematicians came with a solution to work around this problem and that came the idea
of complex numbers.
𝑓(𝑥) = 𝑥 2 + 1
To solve for the roots, we must know what values of x that will make 𝑓(𝑥) = 0. To
do this we follow the steps below:
Equate 𝑓(𝑥) = 0 𝑥2 + 1 = 0
Transpose 1 𝑥 2 = −1
But we knew that there is no such real number as a square root of a negative
number. So, we must assign another kind of mathematical concept to represent √−1 and
that’s where imaginary unit 𝑖 𝑜𝑟 𝑗 came in.
𝑖 𝑜𝑟 𝑗 = √−1
Why is it represented by either of the two letters? Well, mathematicians usually
use 𝑖 but electrical engineers sometimes mistake it for the current. So, they use 𝑗 instead
of 𝑖 so to not cause confusion. But in this course we will prefer to the use of 𝑗 as the
imaginary unit during manual computation but refer to 𝑖 when programming in MATLAB®.
On the other hand, complex number is any number that is represented by the form:
𝑎 + 𝑗𝑏
in which 𝑎 is a real number and 𝑗𝑏 is an imaginary number. 𝑎 in this sense is what we call
the real component while 𝑏 referred to as the imaginary component.
ℤ = 𝑎 + 𝑗𝑏
in which the real component 𝑅𝑒{ℤ} = 𝑎 and the imaginary component 𝐼𝑚{ℤ} = 𝑏 can be
graphically represented in the complex plane or Argand’s diagram as a point just like in a
Cartesian coordinate plane. For example, the following complex numbers 𝕄 and ℕ may
be plotted in the complex plane.
𝑏 𝒓 𝑠𝑖𝑛 𝜃 𝑏
To get 𝜃, we must divide 𝑎 from 𝑏 = 𝒓 𝑐𝑜𝑠 𝜃 = tan 𝜃; 𝜃 = tan−1 𝑎
𝑎
Now, we can equate the equivalence of the following forms of complex numbers
to obtain the exponential form:
𝑎 + 𝑗𝑏 (𝑟𝑒𝑐𝑡𝑎𝑛𝑔𝑢𝑙𝑎𝑟) ⇔ 𝒓𝑒 𝑗𝜃 (𝑒𝑥𝑝𝑜𝑛𝑒𝑛𝑡𝑖𝑎𝑙)
𝑏
in which 𝒓 = √𝑎2 + 𝑏 2 and 𝜃 = tan−1 𝑎 and conversely 𝑎 = 𝒓 𝑐𝑜𝑠 𝜃 and 𝑏 = 𝒓 𝑠𝑖𝑛 𝜃.
Further, the exponential form has a shorthand notation of 𝒓∠𝜃 for simplicity referred to as
polar form making it:
The polar form can be plotted in the complex plane as the following:
(𝑎, 𝑗𝑏)
𝒓
𝑏 = 𝒓 𝑠𝑖𝑛 𝜃
𝑎 = 𝒓 𝑐𝑜𝑠 𝜃
Fig 2. Polar form of a complex number in the complex plane (Hayt, et.al., 2012)
Examples
Here are some important identities you need to remember when performing
operations on complex numbers.
1
𝑗 2 = −1 = −𝑗 (𝒓∠𝜃)𝑚 = 𝒓𝒎 ∠𝑚𝜃 = 𝒓𝒎 [cos 𝑚𝜃 + 𝑗 sin 𝑚𝜃]
𝑗
Note: Complex numbers in polar form cannot be added or subtracted directly unless they
are converted first to rectangular form.
𝑨∠𝜃1 𝑨
= ∠(𝜃1 − 𝜃2 )
𝑩∠𝜃2 𝑩
Examples
Materials
Procedure
1. Make sure you already have installed MATLAB software or app in your computer
or mobile phone. Click the software/app to open.
2. For those using the software:
a. In the Menu bar, click New Script.
b. Save your output by Clicking on Save or alternately you can press the
keyboard shortcut key CTRL+S.
c. Save filename as “(your surname)_EcE224Lab1.m”.
c. Click the plus sign on the top right then select New Script.
d. Type the filename of your activity based on above format and click Create.
EcE
1. Type the following line of code in MATLAB script to convert the following
rectangular complex number to polar: 𝟑. 𝟏𝟐 − 𝒋√𝟑 ⇒ 𝒓∠𝜃
2. Click run then write on the space below the output you see in the
Command Window.
>>
3. Highlight previous code, press CTRL+R (For those using MATLAB App, you can
only place the comment symbol % instead before each line so they will be ignored
and will not be executed) and type this different code using cart2pol function and
compare it with your previous result.
4. Now we do the reverse. Using the saved values of 𝒓 and 𝜃 from the previous codes,
highlight previous code, press CTRL+R (For those using MATLAB App, you can
only place the comment symbol % instead before each line so they will be ignored
and will not be executed) and type the code below to convert it back to rectangular
form. 𝒓∠𝜃 ⇒ 𝒂 − 𝒋𝒃
5. Click run then write on the space below the output you see in the
Command Window.
>>
6. Highlight previous code, press CTRL+R (For those using MATLAB App, you can
only place the comment symbol % instead before each line so they will be ignored
and will not be executed) and type this different code using pol2cart function and
compare it with your previous result.
7. Repeat steps 1-3 with the example given on item no. 1 page 3. Write on the space
below the output you see in the Command Window.
>>
8. Repeat steps 4-6 with the example given on item no. 2 page 3. Write on the space
below the output you see in the Command Window. Note that you need to specify
the value of 𝒓 and 𝜃 before you run the code.
>>
1. Given the complex numbers ℤ1 = −2.3 + 𝑗6.5 and ℤ2 = 1.4 − 𝑗0.86, highlight
previous code, press CTRL+R (For those using MATLAB App, you can only place
the comment symbol % instead before each line so they will be ignored and will
not be executed) and type the following to solve for their sum ℤ1 + ℤ2 and
difference ℤ1 − ℤ2 .
2. Click run then write on the space below the output you see in the
Command Window.
>>
3. Given the same complex numbers above, highlight previous code, press CTRL+R
(For those using MATLAB App, you can only place the comment symbol % instead
before each line so they will be ignored and will not be executed) and type the
following code to solve for their product ℤ1 ∗ ℤ2 and quotient ℤ1 /ℤ2 .
4. Click run then write on the space below the output you see in the
Command Window.
>>
D. Submission of Output
1. Write the manual solution of Part B, steps 1 and 4 and Part C, steps 1 and 3 on a
sheet of paper and take photos of them. Name each photo as “Lab Act
1_Solution_(number based on sequence)”.
2. Answer the guide questions below and accomplish Laboratory Report 1 with the
template to be provided by the faculty in charge.
3. Upload the Laboratory Report 1 in PDF form along with the photos of the manual
solution and the M-file to the submission link to be provided by the faculty in
charge.
Guide Question
Rubrics
Your Laboratory Report 1 shall be rated based on the following rubric.