Skip to content Skip to navigation

Connexions

You are here: Home » Content » Basic Complex and Matrix Operations

Navigation

Content Actions

  • Download module PDF
  • Add to ...
    Add the module to:
    • My Favorites
    • A lens
    • An external social bookmarking service
    • My Favorites (What is 'My Favorites'?)
      'My Favorites' is a special kind of lens which you can use to bookmark modules and collections directly in Connexions. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need a Connexions account to use 'My Favorites'.
    • A lens (What is a lens?)

      Definition of a lens

      Lenses

      A lens is a custom view of Connexions content. You can think of it as a fancy kind of list that will let you see Connexions through the eyes of organizations and people you trust.

      What is in a lens?

      Lens makers point to Connexions materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

      Who can create a lens?

      Any individual Connexions member, a community, or a respected organization.

      What are tags? tag icon

      Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

    • External bookmarks
  • E-mail the author
  • Rate this module (How does the rating system work?)

    Rating system

    Ratings

    Ratings allow you to judge the quality of modules. If other users have ranked the module then its average rating is displayed below. Ratings are calculated on a scale from one star (Poor) to five stars (Excellent).

    How to rate a module

    Hover over the star that corresponds to the rating you wish to assign. Click on the star to add your rating. Your rating should be based on the quality of the content. You must have an account and be logged in to rate content.

    (0 ratings)

Recently Viewed

This feature requires Javascript to be enabled.

Basic Complex and Matrix Operations

Module by: Darryl Morrell Based on: Basic operations in MATLAB by Anders Gjendemsjø, Darryl Morrell

Summary: This module covers basic complex and matrix operations in an m-file environment.

Note: Your browser may not currently support MathML. See our browser support page for additional details. You can always view the correct math in the PDF version.

Complex numbers

m-file environments have excellent support for complex numbers. The imaginary unit is denoted by i or (as preferred in Electrical Engineering) j. To create complex variables z1=7+ z1 7 and z2=2eπ z2 2 e simply enter z1 = 7 + j and z2 = 2*exp(j*pi)

The table gives an overview of the basic functions for manipulating complex numbers, where zz is a complex number.

Table 1: Manipulating complex numbers
  m-file
Re(zz) real(z)
Im(zz) imag(z)
|z|z abs(z)
Angle(zz) angle(z)
z*z* conj(z)

Operations on Matrices

In addition to scalars, m-file environments can operate on matrices. Some common matrix operations are shown in the Table below; in this table, M and N are matrices.

Table 2: Common matrix operations
Operation m-file
MNMN M*N
M-1M-1 inv(M)
MTMT M'
det(MM) det(M)

Some useful facts:

  • The functions length and size are used to find the dimensions of vectors and matrices, respectively.
  • Operations can also be performed on each element of a vector or matrix by proceeding the operator by ".", e.g .*, .^ and ./.

Example 1

Let A= 1 1 1 1 A 1 1 1 1 . Then A^2 will return AA= 2 2 2 2 AA 2 2 2 2 , while A.^2 will return 12121212= 1 1 1 1 12 12 12 12 1 1 1 1 .

Example 2

Given a vector x, compute a vector y having elements yn=1sinxn yn 1 xn . This can be easily be done the command y=1./sin(x) Note that using / in place of ./ would result in the (common) error "Matrix dimensions must agree".

Comments, questions, feedback, criticisms?

Send feedback