<< Chapter < Page Chapter >> Page >
This module is part of the collection, A First Course in Electrical and Computer Engineering . The LaTeX source files for this collection were created using an optical character recognition technology, and because of this process there may be more errors than usual. Please contact us if you discover any errors.

The number - 1 is predefined in MATLAB and stored in the two variable locations denoted byand. This double definition comes from the preference of mathematicians for using i and the preference of engineers for using j (with i denoting electrical current).andare variables, and their contents may be changed. If you type, then this is the value forandno longer contains - 1 . Type into restore the original value. Note the way a complex variable is displayed. If you type, you should get the answer i

The same value will be displayed for. Try it. Using, you can now enter complex variables. For example, enterand. Asis a variable, you have to use the multiplication sign. Otherwise, you will get an error message. MATLAB does not differentiate (except in storage)between a real and a complex variable. Therefore variables may be added, subtracted, multiplied, or even divided. For example, type in. The real and imaginary parts ofare both divided by. MATLAB just treats the real variableas a complex variable with a zero imaginary part. A complex variable that happens to have a zero imaginarypart is treated like a real variable. Subtractfromand display the result. z1

MATLAB contains several built-in functions to manipulate complex numbers. For example,extracts the real part of the complex number. Type z

to get the result

Similarly,extracts the imaginary part of the complex number. The functionsandcompute the absolute value (magnitude) of the complex numberand its angle (in radians). For example, type z

The last command shows how to get back the original complex number from its magnitude and angle. This is clarified in Chapter 1: Complex Numbers.

Another useful function,, returns the complex conjugate of the complex number. Ifwhereandare real, thenis equal to. Verify this for several complex numbers by using the function. conj (z)

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, A first course in electrical and computer engineering. OpenStax CNX. Sep 14, 2009 Download for free at http://cnx.org/content/col10685/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'A first course in electrical and computer engineering' conversation and receive update notifications?

Ask