PID Without a PhD

Tim Wescott April 26, 201611 comments

I both consult and teach in the area of digital control. Through both of these efforts, I have found that while there certainly are control problems that require all the expertise I can bring to bear, there are a great number of control problems that can be solved with the most basic knowledge of simple controllers, without resort to any formal control theory at all.

This article will tell you how to implement a simple controller in software and how to tune it without getting into heavy...

Digital Envelope Detection: The Good, the Bad, and the Ugly

Rick Lyons April 3, 20168 comments

Recently I've been thinking about the process of envelope detection. Tutorial information on this topic is readily available but that information is spread out over a number of DSP textbooks and many Internet web sites. The purpose of this blog is to summarize various digital envelope detection methods in one place.

Here I focus on envelope detection as it is applied to an amplitude-fluctuating sinusoidal signal where the positive-amplitude fluctuations (the sinusoid's envelope)...

Harmonic Notch Filter

Mike March 28, 201614 comments

My basement is covered with power lines and florescent lights which makes collecting ECG and EEG data  rather difficult due to the 60 cycle hum.  I found the following notch filter to work very well at eliminating the background signal without effecting the highly amplified signals I was looking for. 

The notch filter is based on the a transfer function with the form $$H(z)=\frac{1}{2}(1+A(z))$$ where A(z) is an all pass filter. The original paper [1] describes a method to...

A Useful Source of Signal Processing Information

Rick Lyons March 23, 20168 comments

I just discovered a useful web-based source of signal processing information that was new to me. I thought I'd share what I learned with the subscribers here on

The Home page of the web site that I found doesn't look at all like it would be useful to us DSP fanatics. But if you enter some signal processing topic of interest, say, "FM demodulation" (without the quotation marks) into the 'Search' box at the top of the web page

and click the red 'SEARCH...

3 Good News

Stephane Boucher March 9, 20161 comment
Good News #1

Last week, I announced a new and ambitious reward program that will be funded by the new Vendors Directory.

This week, I am happy to announce that we have our firsts two sponsors!  Quantum Leaps & Abelon Systems have agreed to pay the sponsorship fee to be listed in the new Vendors Directory.  Because of their support, there is now some money in the reward pool ($1,000) and enough to pay for the firsts 500 'beers' awarded.  Please...

Padé Delay is Okay Today

Jason Sachs March 1, 20164 comments

This article is going to be somewhat different in that I’m not really writing it for the typical embedded systems engineer. Rather it’s kind of a specialized topic, so don’t be surprised if you get bored and move on to something else. That’s fine by me.

Anyway, let’s just jump ahead to the punchline. Here’s a numerical simulation of a step response to a \( p=126, q=130 \) Padé approximation of a time delay:

Impressed? Maybe you should be. This...

Go Big or Go Home - Generating $500,000 for Contributors

Stephane Boucher February 18, 20168 comments
In a Nutshell
  • A new Vendors Directory has been created
  • Vendors will be invited to pay a sponsorship fee to be listed in the directory
  • 100% of the basic sponsorship fee will be distributed to the *Related Sites community through a novel reward system
  • The goal is for the directory to eventually generate - drum roll please -  $500,000 on a yearly basis for contributing members on the *Related Sites
  • Members will choose how the reward money gets distributed between...

The New Forum is LIVE!

Stephane Boucher February 18, 20161 comment

After months of hard word, I am very excited to introduce to you the new forum interface.  

Here are the key features:

1- Easily add images to a post by drag & dropping the images in the editor

2- Easily attach files to a post by drag & dropping the files in the editor

3- Add latex equations to a post and they will be rendered with Mathjax (tutorial)

4- Add a code snippet and surround the code with

Autocorrelation and the case of the missing fundamental

Allen January 21, 201610 comments

[UPDATED January 25, 2016:  One of the examples was broken, also the IPython notebook links now point to nbviewer, where you can hear the examples.]

For sounds with simple harmonic structure, the pitch we perceive is usually the fundamental frequency, even if it is not dominant.  For example, here's the spectrum of a half-second recording of a saxophone.

The first three peaks are at 464, 928, and 1392 Hz.  The pitch we perceive is the fundamental, 464 Hz, which is close to...

Generating pink noise

Allen January 20, 20161 comment

In one of his most famous columns for Scientific American, Martin Gardner wrote about pink noise and its relation to fractal music.  The article was based on a 1978 paper by Voss and Clarke, which presents, among other things, a simple algorithm for generating pink noise, also known as 1/f noise.

The fundamental idea of the algorithm is to add up several sequences of uniform random numbers that get updated at different rates. The first source gets updated at...

A Simple Complex Down-conversion Scheme

Rick Lyons January 21, 20085 comments
Recently I was experimenting with complex down-conversion schemes. That is, generating an analytic (complex) version, centered at zero Hz, of a real bandpass signal that was originally centered at ±fs/4 (one fourth the sample rate). I managed to obtain one such scheme that is computationally efficient, and it might be of some mild interest to you guys. The simple complex down-conversion scheme is shown in Figure 1(a).

It works like this: say we have a real xR(n) input bandpass...

Goertzel Algorithm for a Non-integer Frequency Index

Rick Lyons October 7, 2013

If you've read about the Goertzel algorithm, you know it's typically presented as an efficient way to compute an individual kth bin result of an N-point discrete Fourier transform (DFT). The integer-valued frequency index k is in the range of zero to N-1 and the standard block diagram for the Goertzel algorithm is shown in Figure 1. For example, if you want to efficiently compute just the 17th DFT bin result (output sample X17) of a 64-point DFT you set integer frequency index k = 17 and N =...

A poor man's Simulink

Markus Nentwig January 24, 20153 comments

Glue between Octave and NGSPICE for discrete- and continuous time cosimulation (download) Keywords: Octave, SPICE, Simulink


Many DSP problems have close ties with the analog world. For example, a switched-mode audio power amplifier uses a digital control loop to open and close power transistors driving an analog filter. There are commercial tools for digital-analog cosimulation: Simulink comes to mind, and mainstream EDA vendors support VHDL-AMS or Verilog-A in their...

Design of an anti-aliasing filter for a DAC

Markus Nentwig August 18, 2012
  • Octaveforge / Matlab design script. Download: here
  • weighted numerical optimization of Laplace-domain transfer function
  • linear-phase design, optimizes vector error (magnitude and phase)
  • design process calculates and corrects group delay internally
  • includes sinc() response of the sample-and-hold stage in the ADC
  • optionally includes multiplierless FIR filter
Problem Figure 1: Typical FIR-DAC-analog lowpass line-up

Digital-to-analog conversion connects digital...

Signed serial-/parallel multiplication

Markus Nentwig February 16, 2014

Keywords: Binary signed multiplication implementation, RTL, Verilog, algorithm

  • A detailed discussion of bit-level trickstery in signed-signed multiplication
  • Algorithm based on Wikipedia example
  • Includes a Verilog implementation with parametrized bit width
Signed serial-/parallel multiplication

A straightforward method to multiply two binary numbers is to repeatedly shift the first argument a, and add to a register if the corresponding bit in the other argument b is set. The...

Spline interpolation

Markus Nentwig May 11, 20142 comments

A cookbook recipe for segmented y=f(x) 3rd-order polynomial interpolation based on arbitrary input data. Includes Octave/Matlab design script and Verilog implementation example. Keywords: Spline, interpolation, function modeling, fixed point approximation, data fitting, Matlab, RTL, Verilog


Splines describe a smooth function with a small number of parameters. They are well-known for example from vector drawing programs, or to define a "natural" movement path through given...

DSP Related Math: Nice Animated GIFs

Stephane Boucher April 24, 20143 comments

I was browsing the ECE subreddit lately and found that some of the most popular posts over the last few months have been animated GIFs helping understand some mathematical concepts.  I thought there would be some value in aggregating the DSP related gifs on one page.  

The relationship between sin, cos, and right triangles: Constructing a square wave with infinite series (see this...

The Exponential Nature of the Complex Unit Circle

Cedron Dawg March 10, 20152 comments

This is an article to hopefully give an understanding to Euler's magnificent equation:

$$ e^{i\theta} = cos( \theta ) + i \cdot sin( \theta ) $$

This equation is usually proved using the Taylor series expansion for the given functions, but this approach fails to give an understanding to the equation and the ramification for the behavior of complex numbers. Instead an intuitive approach is taken that culminates in a graphical understanding of the equation.


Setting the 3-dB Cutoff Frequency of an Exponential Averager

Rick Lyons October 22, 20126 comments

This blog discusses two ways to determine an exponential averager's weighting factor so that the averager has a given 3-dB cutoff frequency. Here we assume the reader is familiar with exponential averaging lowpass filters, also called a "leaky integrators", to reduce noise fluctuations that contaminate constant-amplitude signal measurements. Exponential averagers are useful because they allow us to implement lowpass filtering at a low computational workload per output sample.

Figure 1 shows...

Two jobs

Stephane Boucher December 5, 201223 comments

For those of you following closely embeddedrelated and the other related sites, you might have noticed that I have been less active for the last couple of months, and I will use this blog post to explain why. The main reason is that I got myself involved into a project that ended up using a better part of my cpu than I originally thought it would.

I currently have two jobs: one as an electrical/dsp engineer recycled as a web publisher and the other as a parent of three kids. My job...