**- DSP log - http://www.dsplog.com -**

Approximate Vector Magnitude Computation

Posted By __Krishna Sankar__ On February 8, 2009 @ 6:43 am In __DSP__ | __7 Comments__

In this post, let us discuss a simple implementation friendly scheme for computing the absolute value of a complex number . The technique called (alpha Max + beta Min) algorithm is discussed in Chapter 13.2 of Understanding Digital Signal Processing, Richard Lyons ^{[1]} and is also available online at Digital Signal Processing Tricks – High-speed vector magnitude approximation ^{[2]}

The magnitude of a complex number is

.

The simplified computation of the absolute value is

where

.

The values of and can be tried out to understand the performance. For analysis we can use a complex number with magnitude 1 and phase from 0 to 180 degrees.

**Option#1 **

= 1, = 1/2,

**Option#2 **

= 1, = 1/4,

**Option#3 **

= 1, = 3/8

**Option#4 **

= 7/8, = 7/16

**Option#5 **

= 15/16, = 15/32

The script performs the following.

(a) Generate a complex number with phase varying from 0 to 180 degrees.

(b) Find the absolute value using the above 5 options

(c) For each option, find the maximum error, average error and root mean square error

Click here to download Matlab/Octave script for computing the approximate value of magnitude of a complex number ^{[3]}

**Figure: Plot of approximate value of magnitude of a complex number**

Option | alpha | beta | Maximum Error % | Average Error % | RMS error % |

1 | 1 | 1/2 | 11.80340 | 8.67667 | 9.21159 |

2 | 1 | 1/4 | -11.60134 | -0.64520 | 4.15450 |

3 | 1 | 3/8 | 6.80005 | 4.01573 | 4.76143 |

4 | 7/8 | 7/16 | -12.50000 | -4.90792 | 5.60480 |

5 | 15/16 | 15/32 | -6.25000 | 1.88438 | 3.45847 |

**Table: Error in the approximate value computation with various values of **,

1. The chosen values of , facilitates simple multiplier-less implementation of approximate computation (can be implemented using only bit shift and addition).

2. For Options (1), (3) the maximum error is more than the expected value. Hence we need to allocate extra bits for the output to prevent overflow.

3. The error in the approximate magnitude computation repeats every 90 degrees.

Chapter 13.2 of Understanding Digital Signal Processing, Richard Lyons ^{[1]}

Article printed from DSP log: **http://www.dsplog.com**

URL to article: **http://www.dsplog.com/2009/02/08/approximate-vector-magnitude-computation/**

URLs in this post:

[1] Understanding Digital Signal Processing, Richard Lyons: **http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FUnderstanding-Digital-Signal-Processing-Richard%2Fdp%2F0201634678&tag=dl04-20&linkCode=ur2&camp=1789&creative=9325**

[2] Digital Signal Processing Tricks – High-speed vector magnitude approximation : **http://www.embedded.com/design/embeddeddsp/202600924?_requestid=7638**

[3] Matlab/Octave script for computing the approximate value of magnitude of a complex number: **http://www.dsplog.com/db-install/wp-content/uploads/2009/02/script_approximate_vector_magnitude_computation.m**

[4] click here to SUBSCRIBE : **http://www.feedburner.com/fb/a/emailverifySubmit?feedId=1348583&loc=en_US**

Click here to print.

Copyright © 2007-2012 dspLog.com. All rights reserved. This article may not be reused in any fashion without written permission from http://www.dspLog.com.