EDN logo


Design Ideas: August 3, 1995

Algorithm evaluates complex fractions

Paul Johnson,
Hewlett-Packard, Escondido, CA

The following algorithm uses rectangular-to-polar conversion to evaluate a complex fraction (one that includes imaginary numbers). The algorithm is most convenient when you can perform the rectangular-to-polar-coordinate and polar-to-rectangular-coordinate conversions using a calculator such an HP 11C. You can reduce all the necessary steps to two keystrokes or, if the calculator is programmable, to one program step. When computing transfer functions and Bode plots, you can determine the gain and phase at the end of step 4 before doing step 5.

The algorithm steps are as follows:

  1. Reduce each complex term to a rectangular-coordinate number of the form x+yi.
  2. Convert each term from a rectangular-coordinate number of the form x+yi to a polar-coordinate number of the form (r,[theta]).
  3. Calculate the r of the resulting polar coordinate by calculating the product of the r's in the numerator divided by the product of the r's in the denominator.
  4. Calculate the [theta] of the resulting polar coordinate by computing the sum of the [theta]'s in the numerator minus the sum of the [theta]'s in the denominator.
  5. Convert the resulting polar coordinate number of the form (r,[theta]) to a rectangular coordinate number of the form x+yi.
Eqs 1 and 2 show these five steps:

The following formulas define the relationship between the

rectangular and polar coordinates:

x = rcos[theta]

y = rsin[theta]

x2 = y2=r2

(DI#1743)


| EDN Access | feedback | subscribe to EDN! |
| design features | design ideas | columnist |

Copyright © 1995 EDN Magazine. EDN is a registered trademark of Reed Properties Inc, used under license.