ECEA106L EXP1 MATLAB and Complex Numbers PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

INTERPRETATION OF RESULTS

MATLAB, whose name is an abbreviation that stands for MATrix LABoratory, is a


high-performance language for technical computing that integrates the following in one
platform: computation, visualization, and programming. MATLAB consists mainly of four
different windows: (1) the command window, where you type the commands and the
outputs appear here; (2) workspace window, where it shows a list of user-defined
variables; (3) command history window, where past commands are listed; and lastly (4)
current directory window, which shows the files in current directory of MATLAB. In terms
of programming, a constant is a value, that once initialized to the value specified in the
property block, cannot be changed. MATLAB includes a number of predefined constants
such as pi, i or j, Inf, and NaN. Variables are used to store values to be referenced and
manipulated in MATLAB. And lastly, an expression is the mathematical equation or
function itself, and hence it uses variables, operators, constants and combinations
thereof.
The laboratory exercises included in the manual consisted mainly on problems
involving complex numbers, and in order to solve them through MATLAB, there were
several special functions used to obtain the desired answer. In MATLAB, both i and j
denote the constant of imaginary unit i, which is equivalent to the square root of -1. A
complex number is defined as the sum or difference of a real and imaginary number.
For the first part of the laboratory exercises, it involved different mathematical
operations, specifically arithmetic, trigonometric, and logarithmic operations involving
complex numbers. All basic arithmetic operations are available in MATLAB just like with
a calculator, for example: +, -, /, *, etc. When dealing with logarithms, MATLAB uses
different syntaxes whether it is a common (or Brigssian) logarithm whose notation is log,
or natural (or Napierian) logarithm whose notation is ln. For common logarithm, it uses
the syntax of log10(x) (for base 10), but on the other hand, the natural logarithm uses
log(x), which can get confusing at times. Both logarithm functions return real values for
real value of x, and complex values for complex or negative real values of x. For special
functions involving complex, we use real and imag to get the real and imaginary part
of the complex number, respectively. In addition, we can use abs and angle to get the
modulus and argument of the complex number, respectively. The majority of the
questions were answered correctly, but there were some mistakes on several questions
that I could not get the answers of.
For the second part, we verified using angle(z) function in MATLAB that, given
z1 = -1 + i, z2 = sqrt(3)+ i, and z3 = 1 + i*sqrt(3), the sum of the arguments
of z1 and z2 is equal to the argument of the product of z1 and z2; but the sum of the
arguments of z1 and z3 is not equal to the argument of the product of z1 and z3. The
disparity of the values is due to the fact that the argument of z1 and z2 are coterminal
angles hence the equation holds true, but the case is not the same with z1 and z3.
The last exercise asked for a script file that can be used to determine the four
possible values of i^n, where n is an integer greater than 0. The answers are in the order
of i,-1, -i, and 1, and this pattern repeats itself with increasing value of n. The approach
that used here is that since it was already demonstrated that there were four possible
values for the given expression, we used the modulo operator (the remainder after
division) to determine the answer immediately without solving the operation on the
complex number itself: mod(n,4). The script file works as such that it computes for integer
n modulo 4 and displays the appropriate answer (using disp() function) that when the
remainder is 1, the answer is i; -1 when remainder is 2; -i when remainder is 3; and 1
when the remainder is 4.

CONCLUSION
According to the objectives of this experiment, we were able to familiarize
ourselves with the MATLAB program along with windows and tools that are utilized when
solving mathematical expressions. We had also demonstrated, through the given
laboratory exercises, the different mathematical operations involving complex numbers
that the MATLAB is capable of, and by answering all of them, we were able to differentiate
the difference between a constant, variable, and expression in the MATLAB programming
language. And lastly, we were able to construct a simple script file for computing complex
numbers, specifically, we solved for the four possible values of i^n. Moreover, this
laboratory experiment teaches the learners to become familiarized with MATLAB
programming platform, wherein the skills obtained will be useful on later experiments. The
objectives were met; therefore, the experiment was a success.

REFERENCES
Houcque, D. (2005). Introduction to Matlab for engineering students. Northwestern
University, 1-64.
University of New South Wales. (n.d.). MATLAB Lesson 1 - Complex numbers. Retrieved
from https://www.maths.unsw.edu.au/sites/default/files/MatlabSelfPaced/lesson1/
MatlabLesson1_Complex.html
Mathworks. (n.d.). Symbolic Computations in MATLAB. Retrieved from
https://www.mathworks.com/help/symbolic/symbolic-computations-in-matlab.html
University of Regina. (n.d.). Introduction to MATLAB. Retrieved from
http://www.cs.uregina.ca/Links/class-info/425-nova/MatlabIntro/index.html
MAPÚA UNIVERSITY
EECE Department

Experiment 1
MATLAB AND
COMPLEX NUMBERS

Name: Bautista, Azriell V.


Program / Year: ECE – 2
Course Code / Section: ECEA106L – B12
Terminal No.: 27
Date of Performance: 11 November 2019
Date of Submission: 18 November 2019

Prof. Ernesto Vergara Jr.


Instructor

You might also like