# approximation

## DSP Trick: Simultaneous Parabolic Approximation of Sin and Cos

```From: Olli Niemitalo (oniemita@mail.student.oulu.fi)
Subject: Trick: Simultaneous parabolic approximation of sin and cos
Newsgroups: comp.dsp
Date: 2001-06-30 05:15:09 PST```

Name: Simultaneous parabolic approximation of sin and cos

## DSP Trick: Square Root Computation

```Date: Mon, 19 Apr 1999 17:50:23 +0200
From: rainer storn <rainer.storn@hl.siemens.de>
Newsgroups: comp.dsp
Subject: Square root computation
THIS WORK IS PLACED IN THE PUBLIC DOMAIN
```

Name: Square root computation

Category: Algorithmic Trick

Application: e.g. Magnitude computation

Introduction:

Once in a while the square root of data has to be computed on a DSP. A method that comes to mind is polynomial approximation of the square root function.

## DSP Trick: Sinusoidal Tone Generator

```Subject: Trick : Tone Generation
From: Darrell <darrell@havoc.gtf.org>
Date: 1999/04/19
Newsgroups: comp.dsp
THIS WORK IS PLACED IN THE PUBLIC DOMAIN
```

Name: Sinusoidal tone generator

Category: Algorithm

Application: If they need to generate a continuous tone of specific frequency and amplitude.

Introduction:

I've seen this trick in a few different places, although never the (very simple) deriviation.

## Function Approximation Tricks

In DSP, the exact value of a mathematical function usually isn't needed: a degree of inaccuracy usually can be tolerated, and computational speed usually is a primary concern. The right combination of accuracy and speed is very much application-specific.

Approximation of mathematical functions, therefore, is an important subject in DSP. Highly accurate approximations are well known. However, here we present some less-well known approximation DSP tricks which provide an outstanding combination of speed and accuracy.

## DSP Trick: Fixed-Point Atan2 With Self Normalization

```Subject: DSP Trick:  Fixed-pt. Atan2 with Self Normalization
From: Jim Shima
Date: 1999/04/23
Newsgroups: comp.dsp
THIS WORK IS PLACED IN THE PUBLIC DOMAIN
```

Name: Fast fixed-pt.

## DSP Trick: Quick-and-Dirty Logarithms

```From: Ray Andraka <ray@andraka.com>
Subject: Quick and dirty logarithm trick
Date: 22 Jun 2000 00:00:00 GMT
Newsgroups: comp.dsp
THIS WORK IS PLACED IN THE PUBLIC DOMAIN
```

Name: Quick and dirty logarithms

Category: Algorithmic

Application: Needs fairly precise logarithm of a value quickly.

Advantages: Very fast, very little computation. Look up table is small for precision to well under a dB. Compact hardware implementation. Works for arbitary logarithm bases.

## How to Create Oscillators in Software

Oscillators can be created in software directly, using the "sine" function, or they can be calculated indirectly using several different iterative methods. We survey those methods here.

#### Notation:

First, let's assume that:

## DSP Trick: Fast Floating-Point to mu-Law Conversion

```From: Jim Thomas
Subject: Fast floting point to mu-law conversion
Date: 6 May 1999
THIS WORK IS PLACED IN THE PUBLIC DOMAIN
```

Name: Fast floating point to mu-law conversion

Category: Algorithmic

Application: When you need to convert audio data to mu-law and don't have a lot of time to mess around.

Advantages: Very Fast (I implemented this in a seven cycle loop on a Sharc processor).

Introduction: This trick is based upon the happy coincidence that mu-law compressed

## DSP Trick: Magnitude Estimator

```From: Grant Griffin
Subject: DSP Trick: Magnitude Estimator
Date: 02 Oct 1999 00:00:00 GMT
THIS WORK IS PLACED IN THE PUBLIC DOMAIN
```

Name: Magnitude Estimator

Category: Algorithmic

Application: Signal strength measurement, AM demodulation, etc.

Advantages: This estimation algorithm is very quick compared to calculating magnitude to full precision using a square-root operation.

Introduction: