Presentation is loading. Please wait.

Presentation is loading. Please wait.

Math Review with Matlab:

Similar presentations

Presentation on theme: "Math Review with Matlab:"— Presentation transcript:

1 Math Review with Matlab:
4/1/2017 Math Review with Matlab: Complex Numbers Complex Number Theory S. Awad, Ph.D. M. Corless, M.S.E.E. E.C.E. Department University of Michigan-Dearborn

2 Complex Number Theory General Complex Numbers
General Complex Numbers in Matlab Argand Diagrams Exponential Form Polar Form Polar Form in Matlab

3 Representing Complex Numbers
The conventional representation of a complex number z is the sum of a real part x and an imaginary part y Complex Real Imaginary i is the imaginary unit where: Conventional representation is also referred to as the rectangular form of a complex number

4 4/1/2017 Functional Notation In different applications, the imaginary unit may be represented as i or j and may be placed before or after the imaginary part In functional notation, it is sometimes convenient to write:

5 Matlab Complex Numbers
Matlab complex numbers consist of a real portion plus an imaginary portion For example, use Matlab to find the square root of -1 » sqrt(-1) ans = i Real Portion = 0 Imaginary Portion = -1

6 Entering Complex Numbers
Both the variables i and j in the Matlab workspace are reserved for representing imaginary numbers Placing i or j after a number defines it as imaginary Example: A complex number with real portion = 1 and imaginary portion = 2 can be entered in two ways: » z = 1+2i z = i » z = 1+2j OR

7 Real and Imag Commands The real and imag functions extract the real and imaginary portion of a complex number respectively Example: » z1= 2+4i z1 = i » z1_re = real(z1) z1_re = 2 » z1_im = imag(z1) z1_imag = 4

8 Argand Diagram A complex number can be represented as a Point P(x,y) in the xy-plane (Cartesian plane) This representation is called an Argand Diagram The xy-plane is often referred to as the Complex Plane or the z-plane Ordered Pair Notation

9 Feather Command The feather command draws complex numbers as arrows in the xy plane » z1=1+2j; » z2=3+3j; » z3=3+j; » feather(z1,'r'); » hold on » feather(z2,'b'); » feather(z3,'g'); » feather(z3,'k'); » ylabel('Imaginary'); » xlabel('Real');

10 Exponential Representation
Sometimes an exponential representation of a complex number is easier to manipulate than the rectangular sum of the real and imaginary part The Complex Exponential Function ez will be used to represent a complex number whose Taylor Series Expansion is: We can assume that ez will be valid for all z

11 Exponential Series If z = iq, purely imaginary, where q is real, the complex exponential function can be written using a Taylor Series Expansion: Which can be separated into real and imaginary components since i raised to even powers of n will be -1

12 Derivation of Euler’s Equation
Knowing that the Taylor Series Expansions for sine and cosine functions are: Through substitution, Euler’s Equation is derived:

13 Exponential Polar Form
Through Euler’s Equation we see that: This representation of a complex number is referred to as the Exponential Polar Form: Sometimes Polar Form is written using the shortened notation:

14 Plotting Polar Form Graphically depicting Euler’s Equation in the First Quadrant of an Argand Diagram we see: r refers to the radius from z to the origin, commonly called the Magnitude of z q is the Angle of z with respect to the Real Axis measured in degrees or radians

15 Magnitude Through use of the Pythagorean theorem, the Magnitude (radius) of a complex number always has the relationship: This relationship always holds true regardless of which quadrant of the Argand diagram that the number lies in The Magnitude of a complex number z=x+iy is denoted using Absolute Value notation

16 Angle The angle, q, of a complex number z denoted by:
Determining the angle of a complex number depends on the quadrant of the Argand diagram Measuring the angle counter-clockwise from the x-axis gives a positive q Measuring the angle clockwise from the x-axis gives a negative q Example: The angle of z=0+j can be represented in multiple ways

17 Angle of Quadrants I and IV
Quadrant I Quadrant IV

18 Angle of Quadrants II and III
Quadrant II Quadrant III

19 Purely Real or Imaginary Numbers
Rectangular Rectangular Polar Polar Short Long Degrees Radians 1 = 1 + i0 = 1Ð0° = 1Ð0 -1 = -1 +i0 = 1Ð180° = 1Ðp j = 0 + i1 = 1Ð90° = 1Ðp/2 -j = 0 - i1 = 1Ð-90° = 1Ð-p/2

20 Abs and Angle Commands The abs command in Matlab returns the magnitude of a complex number The angle command returns the angle of a complex number in radians Remember that the conversion between radians and degrees is:

21 Polar Example Use Matlab to find the magnitude and angle of z=1+i
» r=abs(z) r = 1.4142 » theta_rads=angle(z) theta_rads = 0.7854 » theta_degs=theta_rads*180/pi theta_degs = 45

22 Entering Polar Form » z=2*exp(i*pi/2) z = 0.0000 + 2.0000i
Complex numbers can be directly entered into Matlab using the exponential polar form Example: Create a complex number z with a magnitude of 2 and an angle of p/2 radians » z=2*exp(i*pi/2) z = i

23 Polar Plotting » z1=3+3i; » compass(z1) » hold on » compass(4,-3)
Matlab’s compass(z) or compass(x,y) command can be used to draw complex numbers on a polar plot Note that z is a complex number in rectangular form » z1=3+3i; » compass(z1) » hold on » compass(4,-3) Angles are displayed in degrees

24 Plotting Example Example: Plot the following complex numbers by hand. Use Matlab’s compass function to verify your results.

25 Matlab Verification z(1) = 2; z(2) = 3*exp(i*60*(pi/180));
z(3) = -(8^0.5) + j*(8^0.5); z(4) = 4*exp(-i*pi/2); z(5) = 2.5*exp(-i*150*(pi/180)); z(6) = 2i; compass(z)

26 Polar Plot

27 Summary Representing complex numbers in rectangular, exponential, and polar forms Using Euler’s Equation to represent real and imaginary parts of complex numbers Determining magnitude and angles of complex numbers Graphing complex numbers using Argand Diagrams

Download ppt "Math Review with Matlab:"

Similar presentations

Ads by Google