## Interpolator Design: Get the Stopbands Right

In this article, I present a simple approach for designing interpolators that takes the guesswork out of determining the stopbands.

## The Discrete Fourier Transform as a Frequency Response

The discrete frequency response H(k) of a Finite Impulse Response (FIR) filter is the Discrete Fourier Transform (DFT) of its impulse response h(n) [1].  So, if we can find H(k) by whatever method, it should be identical to the DFT of h(n).  In this article, we’ll find H(k) by using complex exponentials, and we’ll see that it is indeed identical to the DFT of h(n).

Consider the four-tap FIR filter in Figure 1, where each block labeled Ts represents a delay of one...

December 4, 2022

In this part, I’ll show how to design a Hilbert Transformer using the coefficients of a half-band filter as a starting point, which turns out to be remarkably simple.  I’ll also show how a half-band filter can be synthesized using the Matlab function firpm, which employs the Parks-McClellan algorithm.

A half-band filter is a type of lowpass, even-symmetric FIR filter having an odd number of taps, with the even-numbered taps (except for the main tap) equal to zero.  This...

In some previous articles, I made use of the Hilbert transformer, but did not explain its theory in any detail.  In this article, I’ll dig a little deeper into how the Hilbert Transformer works.  Understanding the Hilbert Transformer involves a modest amount of mathematics, but the payoff in useful applications is worth it.

As we’ll learn, a Hilbert Transformer is just a particular type of Finite Impulse Response (FIR) filter.  In Part 1 of this article, I’ll...

## Candan's Tweaks of Jacobsen's Frequency Approximation

November 11, 2022
Introduction

This is an article to hopefully give a better understanding of the Discrete Fourier Transform (DFT) by explaining how a tweak to a well known frequency approximation formula makes it better, and another tweak makes it exact. The first tweak is shown to be the first of a pattern and a novel approximation formula is made from the second. It only requires a few extra calculations beyond the original approximation to come up with an approximation suitable for most...

## A Recipe for a Basic Trigonometry Table

October 4, 2022
Introduction

This is an article that is give a better understanding to the Discrete Fourier Transform (DFT) by showing how to build a Sine and Cosine table from scratch. Along the way a recursive method is developed as a tone generator for a pure tone complex signal with an amplitude of one. Then a simpler multiplicative one. Each with drift correction factors. By setting the initial values to zero and one degrees and letting it run to build 45 values, the entire set of values needed...

## Learn About Transmission Lines Using a Discrete-Time Model

January 12, 2022

We don’t often think about signal transmission lines, but we use them every day.  Familiar examples are coaxial cable, Ethernet cable, and Universal Serial Bus (USB).  Like it or not, high-speed clock and signal traces on printed-circuit boards are also transmission lines.

While modeling transmission lines is in general a complex undertaking, it is surprisingly simple to model a lossless, uniform line with resistive terminations by using a discrete-time approach.  A...

## The Discrete Fourier Transform and the Need for Window Functions

The Discrete Fourier Transform (DFT) is used to find the frequency spectrum of a discrete-time signal.  A computationally efficient version called the Fast Fourier Transform (FFT) is normally used to calculate the DFT.  But, as many have found to their dismay, the FFT, when used alone, usually does not provide an accurate spectrum.  The reason is a phenomenon called spectral leakage.

Spectral leakage can be reduced drastically by using a window function in conjunction...

## Modeling Anti-Alias Filters

September 26, 2021

Digitizing a signal using an Analog to Digital Converter (ADC) usually requires an anti-alias filter, as shown in Figure 1a.  In this post, we’ll develop models of lowpass Butterworth and Chebyshev anti-alias filters, and compute the time domain and frequency domain output of the ADC for an example input signal.  We’ll also model aliasing of Gaussian noise.  I hope the examples make the textbook explanations of aliasing seem a little more real.  Of course, modeling of...

## In Search of The Fourth Wave

Last year I participated in the first DSP Related online conference, where I presented a short talk called "In Search of The Fourth Wave". It's based on a small mystery I encountered when I was working on Think DSP.  As you might know:

A sawtooth wave contains harmonics at integer multiples of the fundamental frequency, and their amplitudes drop off in proportion to 1/f.  A square wave contains only odd multiples of the fundamental, but they also drop off...

## A Fixed-Point Introduction by Example

Introduction

The finite-word representation of fractional numbers is known as fixed-point.  Fixed-point is an interpretation of a 2's compliment number usually signed but not limited to sign representation.  It extends our finite-word length from a finite set of integers to a finite set of rational real numbers [1].  A fixed-point representation of a number consists of integer and fractional components.  The bit length is defined...

## A Quadrature Signals Tutorial: Complex, But Not Complicated

Introduction Quadrature signals are based on the notion of complex numbers and perhaps no other topic causes more heartache for newcomers to DSP than these numbers and their strange terminology of j operator, complex, imaginary, real, and orthogonal. If you're a little unsure of the physical meaning of complex numbers and the j = √-1 operator, don't feel bad because you're in good company. Why even Karl Gauss, one the world's greatest mathematicians, called the j-operator the "shadow of...

## Minimum Shift Keying (MSK) - A Tutorial

Minimum Shift Keying (MSK) is one of the most spectrally efficient modulation schemes available. Due to its constant envelope, it is resilient to non-linear distortion and was therefore chosen as the modulation technique for the GSM cell phone standard.

MSK is a special case of Continuous-Phase Frequency Shift Keying (CPFSK) which is a special case of a general class of modulation schemes known as Continuous-Phase Modulation (CPM). It is worth noting that CPM (and hence CPFSK) is a...

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

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)...

## Design IIR Butterworth Filters Using 12 Lines of Code

While there are plenty of canned functions to design Butterworth IIR filters [1], it’s instructive and not that complicated to design them from scratch.  You can do it in 12 lines of Matlab code.  In this article, we’ll create a Matlab function butter_synth.m to design lowpass Butterworth filters of any order.  Here is an example function call for a 5th order filter:

N= 5 % Filter order fc= 10; % Hz cutoff freq fs= 100; % Hz sample freq [b,a]=...

## Use Matlab Function pwelch to Find Power Spectral Density – or Do It Yourself

In my last post, we saw that finding the spectrum of a signal requires several steps beyond computing the discrete Fourier transform (DFT)[1].  These include windowing the signal, taking the magnitude-squared of the DFT, and computing the vector of frequencies.  The Matlab function pwelch [2] performs all these steps, and it also has the option to use DFT averaging to compute the so-called Welch power spectral density estimate [3,4].

## The Exponential Nature of the Complex Unit Circle

Introduction

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.

Complex...

## How to Find a Fast Floating-Point atan2 Approximation

Context Over a short period of time, I came across nearly identical approximations of the two parameter arctangent function, atan2, developed by different companies, in different countries, and even in different decades. Fascinated with how the coefficients used in these approximations were derived, I set out to find them. This atan2 implementation is based around a rational approximation of arctangent on the domain -1 to 1:

 atan(z) \approx \dfrac{z}{1.0 +...