## Update to a Narrow Bandpass Filter in Octave or Matlab

Following my earlier blog post (June 2020) featuring a Narrow Bandpass Filter, I’ve had some useful feedback and suggestions. This has inspired me to come up with an updated version, incorporating the following changes compared to the earlier one :

- Simpler code in Octave or Matlab
- Float32 precision replaces float64
- Faster processing by a factor of at least 4 times
- Easier setup of input parameters
- Normalized signal output level

A new experimental version in...

## Add a Power Marker to a Power Spectral Density (PSD) Plot

Perhaps we should call most Power Spectral Density (PSD) calculations relative PSD, because usually we don’t have to worry about absolute power levels. However, for cases (e.g., measurements or simulations) where we are concerned with absolute power, it would be nice to be able to display it on a PSD plot. Unfortunately, you can’t read the power directly from the plot. For example, the plotted spectral peak of a narrowband signal, such as a sinewave, is lower than the...

## A Simpler Goertzel Algorithm

In this blog I propose a Goertzel algorithm that is simpler than the version of the Goertzel algorithm that is traditionally presented DSP textbooks. Below I very briefly describe the DSP textbook version of the Goertzel algorithm followed by a description of my proposed simpler algorithm.

The Traditional DSP Textbook Goertzel Algorithm

The so-called Goertzel algorithm is used to efficiently compute a single mth-bin sample of an N-point discrete Fourier transform (DFT) [1-4]. The...

## 60-Hz Noise and Baseline Drift Reduction in ECG Signal Processing

Electrocardiogram (ECG) signals are obtained by monitoring the electrical activity of the human heart for medical diagnostic purposes [1]. This blog describes a very efficient digital filter used to reduce both 60 Hz AC power line noise and unwanted signal baseline drift that often contaminate ECG signals.

PDF_HERE

We'll first describe the ECG noise reduction filter and then examine the filter's performance in a real-world ECG signal filtering example.Proposed ECG Noise Reduction Digital...

## Find Aliased ADC or DAC Harmonics (with animation)

When a sinewave is applied to a data converter (ADC or DAC), device nonlinearities produce harmonics. If a harmonic frequency is greater than the Nyquist frequency, the harmonic appears as an alias. In this case, it is not at once obvious if a given spur is a harmonic, and if so, its order. In this article, we’ll present Matlab code to simulate the data converter nonlinearities and find the harmonic alias frequencies. Note that Analog Devices has an online tool for...

## Adaptive Beamforming is like Squeezing a Water Balloon

Adaptive beamforming was first developed in the 1960s for radar and sonar applications. The main idea is that signals can be captured using multiple sensors and the sensor outputs can be combined to enhance the signals propagating from specific directions and attenuate (null out) signals from other directions. It has grown immensely in recent years as processors have become faster and cheaper. Today, adaptive beamforming applications include smart speakers (like the Amazon Echo),...

## Compute Images/Aliases of CIC Interpolators/Decimators

Cascade-Integrator-Comb (CIC) filters are efficient fixed-point interpolators or decimators. For these filters, all coefficients are equal to 1, and there are no multipliers. They are typically used when a large change in sample rate is needed. This article provides two very simple Matlab functions that can be used to compute the spectral images of CIC interpolators and the aliases of CIC decimators.

1. CIC InterpolatorsFigure 1 shows three interpolate-by-M...

## Exploring Human Hearing Range

Human Hearing RangeIn this post, I'll look at an interesting aspect of Audacity – using it to explore the threshold of human hearing. In my book Digital Signal Processing: A Gentle Introduction with Audio Examples, I go into this topic and I include a side note on the amazing hearing range of our canine companions.

Creating a Test Audio FileAudacity allows for the generation of a variety of test signals. If you click the Generate->Tone menu, it looks something like...

## The DSP Online Conference - Right Around the Corner!

It is Sunday night as I write this blog post with a few days to go before the virtual doors of the very first DSP Online Conference open..

It all started with a post in the DSPRelated forum about three months ago. We had just had a blast running the 2020 Embedded Online Conference and we thought it could be fun to organize a smaller event dedicated to the DSP community. So my goal with the post in the forum was to see if...

## The Zeroing Sine Family of Window Functions

IntroductionThis is an article to hopefully give a better understanding of the Discrete Fourier Transform (DFT) by introducing a class of well behaved window functions that the author believes to be previously unrecognized. The definition and some characteristics are displayed. The heavy math will come in later articles. This is an introduction to the family, and a very special member of it.

This is one of my longer articles. The bulk of the material is in the front half. The...

## The Exponential Nature of the Complex Unit Circle

IntroductionThis 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...## Model a Sigma-Delta DAC Plus RC Filter

Sigma-delta digital-to-analog converters (SD DAC’s) are often used for discrete-time signals with sample rate much higher than their bandwidth. For the simplest case, the DAC output is a single bit, so the only interface hardware required is a standard digital output buffer. Because of the high sample rate relative to signal bandwidth, a very simple DAC reconstruction filter suffices, often just a one-pole RC lowpass. In this article, I present a simple Matlab function that models the combination of a basic SD DAC and one-pole RC filter. This model allows easy evaluation of the overall performance for a given input signal and choice of sample rate, R, and C.

## Simple Concepts Explained: Fixed-Point

IntroductionMost signal processing intensive applications on FPGA are still implemented relying on integer or fixed-point arithmetic. It is not easy to find the key ideas on quantization, fixed-point and integer arithmetic. In a series of articles, I aim to clarify some concepts and add examples on how things are done in real life. The ideas covered are the result of my professional experience and hands-on projects.

In this article I will present the most fundamental question you...

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

## Digital PLL's -- Part 2

In Part 1, we found the time response of a 2nd order PLL with a proportional + integral (lead-lag) loop filter. Now let’s look at this PLL in the Z-domain [1, 2]. We will find that the response is characterized by a loop natural frequency ωn and damping coefficient ζ.

Having a Z-domain model of the DPLL will allow us to do three things:

Compute the values of loop filter proportional gain KL and integrator gain KI that give the desired loop natural...## Frequency Formula for a Pure Complex Tone in a DTFT

The analytic formula for calculating the frequency of a pure complex tone from the bin values of a rectangularly windowed Discrete Time Fourier Transform (DTFT) is derived. Unlike the corresponding Discrete Fourier Transform (DFT) case, there is no extra degree of freedom and only one solution is possible.

## Music/Audio Signal Processing

Greetings,

This is my blog from the point of view of a music/audio DSP research engineer / educator. It is informal and largely nontechnical because nearly everything I have to say about signal processing is (or will be) somewhere in my four-book series: Mathematics of DFT with Audio Applications, Introduction to Digital Filters, Physical Audio Signal Processing and

## Polyphase Filters and Filterbanks

ALONG CAME POLY

Polyphase filtering is a computationally efficient structure for applying resampling and filtering to a signal. Most digital filters can be applied in a polyphase format, and it is also possible to create efficient resampling filterbanks using the same theories.

This post will walk through a reference implementation of both the downsampling polyphase filter and a downsampling polyphase filterbank using scipy, numpy, matplotlib, and python. It should also highlight some of...

## Linear Feedback Shift Registers for the Uninitiated, Part XVI: Reed-Solomon Error Correction

Last time, we talked about error correction and detection, covering some basics like Hamming distance, CRCs, and Hamming codes. If you are new to this topic, I would strongly suggest going back to read that article before this one.

This time we are going to cover Reed-Solomon codes. (I had meant to cover this topic in Part XV, but the article was getting to be too long, so I’ve split it roughly in half.) These are one of the workhorses of error-correction, and they are used in...

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

## Round Round Get Around: Why Fixed-Point Right-Shifts Are Just Fine

Today’s topic is rounding in embedded systems, or more specifically, why you don’t need to worry about it in many cases.

One of the issues faced in computer arithmetic is that exact arithmetic requires an ever-increasing bit length to avoid overflow. Adding or subtracting two 16-bit integers produces a 17-bit result; multiplying two 16-bit integers produces a 32-bit result. In fixed-point arithmetic we typically multiply and shift right; for example, if we wanted to multiply some...

## FFT Interpolation Based on FFT Samples: A Detective Story With a Surprise Ending

This blog presents several interesting things I recently learned regarding the estimation of a spectral value located at a frequency lying between previously computed FFT spectral samples. My curiosity about this FFT interpolation process was triggered by reading a spectrum analysis paper written by three astronomers [1].

My fixation on one equation in that paper led to the creation of this blog.

Background

The notion of FFT interpolation is straightforward to describe. That is, for example,...

## Generating pink noise

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

## Frequency Dependence in Free Space Propagation

Introduction

It seems to be fairly common knowledge, even among practicing professionals, that the efficiency of propagation of wireless signals is frequency dependent. Generally it is believed that lower frequencies are desirable since pathloss effects will be less than they would be at higher frequencies. As evidence of this, the Friis Transmission Equation[i] is often cited, the general form of which is usually written as:

Pr = Pt Gt Gr ( λ / 4πd )2 (1)

where the...

## Linear-phase DC Removal Filter

This blog describes several DC removal networks that might be of interest to the dsprelated.com readers.

Back in August 2007 there was a thread on the comp.dsp newsgroup concerning the process of removing the DC (zero Hz) component from a time-domain sequence [1]. Discussed in that thread was the notion of removing a signal's DC bias by subtracting the signal's moving average from that signal, as shown in Figure 1(a).

Figure 1.

At first I thought...

## Embedded Toolbox: Programmer's Calculator

Like any craftsman, I have accumulated quite a few tools during my embedded software development career. Some of them proved to me more useful than others. And these generally useful tools ended up in my Embedded Toolbox. In this blog, I'd like to share some of my tools with you. Today, I'd like to start with my cross-platform Programmer's Calculator called QCalc.

I'm sure that you already have your favorite calculator online or on your smartphone. But can your calculator accept...

## The Number 9, Not So Magic After All

This blog is not about signal processing. Rather, it discusses an interesting topic in number theory, the magic of the number 9. As such, this blog is for people who are charmed by the behavior and properties of numbers.

For decades I've thought the number 9 had tricky, almost magical, qualities. Many people feel the same way. I have a book on number theory, whose chapter 8 is titled "Digits — and the Magic of 9", that discusses all sorts of interesting mathematical characteristics of the...

## An s-Plane to z-Plane Mapping Example

While surfing around the Internet recently I encountered the 's-plane to z-plane mapping' diagram shown in Figure 1. At first I thought the diagram was neat because it's a good example of the old English idiom: "A picture is worth a thousand words." However, as I continued to look at Figure 1 I began to detect what I believe are errors in the diagram.

Reader, please take a few moments to see if you detect any errors in Figure 1.

...## Optimizing the Half-band Filters in Multistage Decimation and Interpolation

This blog discusses a not so well-known rule regarding the filtering in multistage decimation and interpolation by an integer power of two. I'm referring to sample rate change systems using half-band lowpass filters (LPFs) as shown in Figure 1. Here's the story.

Figure 1: Multistage decimation and interpolation using half-band filters.

Multistage Decimation – A Very Brief ReviewFigure 2(a) depicts the process of decimation by an integer factor D. That...

## Phase or Frequency Shifter Using a Hilbert Transformer

In this article, we’ll describe how to use a Hilbert transformer to make a phase shifter or frequency shifter. In either case, the input is a real signal and the output is a real signal. We’ll use some simple Matlab code to simulate these systems. After that, we’ll go into a little more detail on Hilbert transformer theory and design.

Phase ShifterA conceptual diagram of a phase shifter is shown in Figure 1, where the bold lines indicate complex...

## DSP Papers, Articles, Theses, etc

As you may already know, there is a 'Papers and Theses' section on DSPRelated:http://www.dsprelated.com/documents.phpThere are hundreds of DSP Related documents (articles, papers, theses, dissertations, etc) scattered all around the web, and the goal with this section is to find and list as many of those documents as possible in one place. There are, at the moment, a little over 100 documents listed, which I believe is only a small subset of what is available out there, and I need your help...

## Code Snippets Suggestions

Despite being only a couple of months old, the Code Snippet section ( DSPRelated.com/code.php ) already contains tens of snippets, thanks to the contributors who have taken the time to share their code.

But let's not stop here - there is room for several hundreds more snippets before the database can be said to cover a decent portion of the DSP field.

To keep the momentum going, I will do two things:

First, I am modifying the rewards program. Instead of...

## Latest DSP Books

As you may already know, Rick Lyons has just published a new edition of his highly acclaimed book: "Understanding Digital Signal Processing". This book has been getting very high ratings and positive reviews from the DSP community since the publication of the first edition. The 3rd edition seems to contain more than enough new material to justify replacing your old copy.

Also of possible interest to you, a new DSP book by C. Britton Rorabaugh titled "

## Code Snippets Section Now LIVE

The new code sharing section is now live and can be accessed HERE.

Please take a few minutes to rate and/or comment the snippets that you have the expertise to judge.

If you think of some code snippets that you would like to share with the DSP community, please apply to become a contributor HERE.

If you are not aware of the reward program for contributors, your can learn about it HERE.

As always, your comments and suggestions are...

## New Code Sharing Section & Reward Program for Contributors!

UPDATE (11/02/2010): The code section is now live.

UPDATE 2 (01/31/2011): The reward program has changed. A flat fee of $20 per code snippet submitted will now be paid.

_______________

I am very happy to finally announce the imminent launch of the new code sharing section. My vision for this new section is a rich library of high quality code snippets for the DSP community, from processor specific functions to Matlab or Scilab routines, from the simplest filter...

## 50,000th Member Announced!

In my last post, I wrote that DSPRelated.com was about to reach the 50,000 members mark. Well, I am very happy to announce that it happened during the holidays, and the lucky person is Charlie Tsai from Taiwan. Charlie is an assistant professor in the Department of Electrical Engineering at the National Central University in Taiwan where he teaches the "Biomedical Signal Processing" class. He is also the advisor of the

## Almost 50,000 Members!

I am very happy to announce that DSPRelated.com will reach the 50,000 registered members mark before the end of 2009. To celebrate this milestone, I will buy a BMW 5 to the 50,000th person to register (please make sure to confirm you email address to activate your registration). Please read the fine prints after the picture.

I am just having fun here and it's not even April's fool day. The 50,000th member won't get a BMW (I wish I could offer it!),...

## DSPRelated faster than ever!

if you are visiting DSPRelated.com on a regular basis, you should observe that the site loads significantly faster in your browser than it used to, especially if you are in Europe or in Asia. The main reason for this is that I am now using Amazon's CloudFront service for the delivery of most static content on DSPRelated.com (images, javascripts, css). The cloudFront service automatically detects the location of a visitor and will deliver the static content from the server...

## New Papers / Theses Section

The new 'Papers & Theses' section is now online: http://www.dsprelated.com/documents.phpThe idea is to list and organize in one place as many DSP related dissertations (PhD & Masters) and papers/articles as possible.If you are the author of a thesis or paper and would like to have it listed on DSPRelated.com, please follow these steps:- Make sure that you are allowed to share the document online (copyright).- If you don't already have one, make a 'pdf' copy of your document. ...

## New Blog Section!

By now, chances are you have noticed the new blogs section (you are actually in it right now!).

Following an email I sent to the members of the site, a few weeks ago, asking for dsp engineers willing to blog here, I received around 50 propositions. I have selected an initial set of 10 bloggers (that I will soon introduce into a seperate post) and I am currently in the process of creating their accounts. Markus and Parth have already...