Go to CCP Homepage Go to Materials Page Go to Engineering Mathematics Materials Go to Table of Contents
Go Back One Page Go Forward One Page

MATLAB Tutor

Part 14: Basic operations on complex numbers

In this part we examine how MATLAB deals with complex numbers.

  1. The imaginary unit is denoted by i(lower-case "eye") in MATLAB. So, to assign 5+3i to a, enter

    a = 5 + 3*i

    Enter the following complex numbers in your worksheet:


  2. Enter the following lines of MATLAB code, and describe what each of the MATLAB commands does. Check by trying with a number different from a.

    • real(a)

    • imag(a)

    • abs(a)

    • conj(a)


  3. The angle function needs special attention. Enter each of the following:

    • angle(a)

    • angle(b)

    • angle(c)

    • angle(d)

    What is the range of the angle function? Describe carefully what the angle function does.


  4. It is often useful to consider complex numbers in their polar form (Theta, R). The built-in MATLAB function "cart2pol" converts cartesian coordinates (x,y) to polar coordinates (Theta,R).

    Let's convert the complex number a from above to its polar form. Enter:

    [Theta_a, R_a] = cart2pol( real(a), imag(a) )

    Repeat this for b to get [Theta_b, R_b].


  5. The built-in MATLAB function "pol2cart" converts polar coordinates (Theta,R) to cartesian coordinates (x,y). Let's see if we can recover our original a. Enter:

    [x, y] = pol2cart(Theta_a, R_a);
    new_a = x + y*i


    Repeat this for [Theta_b, R_b] to get the original b back.


  6. Calculate the polar form of a*b. How is the polar form of the product related to the polar forms of the factors?

Go to CCP Homepage Go to Materials Page Go to Engineering Mathematics Materials Go to Table of Contents
Go Back One Page Go Forward One Page


modules at math.duke.edu Copyright CCP and the author(s), 1998, 1999, 2000