DSPRelated.com

Frequency Translation by Way of Lowpass FIR Filtering

Rick LyonsRick Lyons February 4, 20175 comments

Rick Lyons shows how you can translate a signal down in frequency and lowpass filter it in a single operation by embedding cosine mixing values into FIR coefficients. The post explains how to build the translating FIR, how to choose the number of coefficient sets, and how decimation can dramatically reduce storage needs while noting practical constraints like the requirement that ft be an integer submultiple of fs.


Fibonacci trick

Tim WescottTim Wescott October 10, 20164 comments

Tim Wescott shares a compact, surprising trick linking Fibonacci numbers and difference equations. Start with any two consecutive Fibonacci numbers, negate the larger-magnitude one, and iterate the usual recurrence; after a few steps you'll arrive at the standard Fibonacci sequence or its negative. This behavior is specific to the Fibonacci recurrence and makes a great illustrative example for teaching linear recurrences.


Harmonic Notch Filter

Mike Mike March 28, 201615 comments

A practical, DSP-friendly recipe for scrubbing 60 Hz power-line hum and its harmonics from noisy ECG and EEG recordings is presented, using IIR notch filters built from second-order all-pass sections. The post derives how to set all-pass phase to place notches and compute biquad coefficients by solving a simple 2x2 system, then shows C code and precomputed coefficients for cascading the first eight odd harmonics at a 2 kHz sample rate. Engineers get a compact, editable implementation with explicit control over notch bandwidth.


Multimedia Processing with FFMPEG

Karthick Kumaran A S VKarthick Kumaran A S V November 16, 2015

FFMPEG is a set of libraries and a command line tool for encoding and decoding audio and video in many different formats. It is a free software project for manipulating/processing multimedia data. Many open source media players are based on FFMPEG libraries.


Understanding and Implementing the Sliding DFT

Eric JacobsenEric Jacobsen April 23, 201512 comments

The Sliding DFT delivers exact DFT results with per-sample frequency updates, making real-time spectral processing far more efficient than repeatedly running an FFT. Eric Jacobsen walks through the derivation, presents the simple recursive update, and covers practical concerns such as initialization and fixed-point stability. Engineers building low-latency, low-power systems will appreciate the algorithm's computational and latency advantages.


A poor man's Simulink

Markus NentwigMarkus Nentwig January 24, 20153 comments

Markus Nentwig built a compact glue layer that embeds NGSPICE into Octave to cosimulate continuous-time circuits and digital control. The article walks through an RC lowpass example, the MEX-based Octave interface, and the breakpoint-driven cosimulation flow, showing how adaptive SPICE integration handles asynchronous and time-triggered events. It presents a practical, low-cost alternative to Simulink for tightly coupled analog-digital system design.


A Complex Variable Detective Story – A Disconnect Between Theory and Implementation

Rick LyonsRick Lyons October 14, 2014

Recently I was in the middle of a pencil-and-paper analysis of a digital 5-tap FIR filter having complex-valued coefficients and I encountered a surprising and thought-provoking problem. So that you can avoid the algebra difficulty I encountered, please read on.

A Surprising Algebra Puzzle

I wanted to derive the H(ω) equation for the frequency response of my FIR digital filter whose complex coefficients were h0, h1, h2, h3, and h4. I could then test the validity of my H(ω)...


The Number 9, Not So Magic After All

Rick LyonsRick Lyons October 1, 20146 comments

Rick Lyons dismantles the mystique around the number 9 by showing its 'magic' stems from our base-10 system rather than any unique numeral power. He walks through classic 9 tricks, including digit-sum divisibility, digital-root behavior, and division patterns, then generalizes them to base-B where digit B-1 plays the same role. The post is a short, playful link between recreational arithmetic and radix thinking.


Specifying the Maximum Amplifier Noise When Driving an ADC

Rick LyonsRick Lyons June 9, 20148 comments

You can quantify how much amplifier noise is acceptable before adding gain actually hurts an ADC's output SNR. Rick Lyons presents a compact rule showing the amplifier input-referred noise power must be less than (1 - 1/α^2) times the ADC's q^2/12 quantization noise power, with Eq. (8) and a pair of figures that make it easy to pick or specify the right amplifier for a given gain α.


A Remarkable Bit of DFT Trivia

Rick LyonsRick Lyons December 26, 20133 comments

Rick Lyons highlights a surprising equality: the DFT's worst-case scalloping loss equals 2/π, the same probability that a toothpick crosses a floorboard seam in Buffon's needle problem when the toothpick equals board width. The post sketches the DFT bin-intersection derivation and connects the math to the classic probability puzzle, offering a playful insight that sharpens intuition about bin responses.


Take Control of Noise with Spectral Averaging

Sam ShearmanSam Shearman April 20, 20183 comments

Spectral averaging turns noisy FFT outputs into repeatable, measurable spectra by trading time for noise control. This post explains the practical difference between RMS averaging, which reduces variance without changing the noise floor, and vector averaging, which can lower the noise floor but requires phase-coherent, triggered inputs. It also shows how linear and exponential weighting affect reaction time for live displays and measurement accuracy.


Computing the Group Delay of a Filter

Rick LyonsRick Lyons November 19, 200817 comments

Rick Lyons presents a neat, practical way to get a filter's group delay directly from its impulse response using only DFTs. The method computes an N-point DFT of h(n) and of n·h(n), divides them in the frequency domain, and takes the real part to obtain group delay in samples, avoiding phase unwrapping. The post includes MATLAB code, a zero-division warning, and a caution that the method is reliable for FIR filters but not always for IIRs.


Accurate Measurement of a Sinusoid's Peak Amplitude Based on FFT Data

Rick LyonsRick Lyons December 14, 201112 comments

Measuring a sinewave's peak from FFT data can be severely biased by scalloping loss, producing errors up to 36.3 percent. Rick Lyons demonstrates how to apply a flat-top window via frequency-domain convolution to the FFT bins, cutting maximum amplitude error to about 0.02 dB compared with 3.9 dB for rectangular windows. The post includes Matlab code and practical caveats for reliable use.


Spectral Flipping Around Signal Center Frequency

Rick LyonsRick Lyons November 7, 20075 comments

Most DSP engineers know that multiplying a real signal by (-1)^n inverts its spectrum about fs/4, but that trick fails when you need to flip around a specific carrier. Rick Lyons presents two practical techniques: a multirate upsample-by-two solution using paired lowpass filters and cosine mixing, and a computationally heavier complex-multiply plus real-part method attributed to Dirk Bell, both yielding the desired fcntr-centered flip.


How Discrete Signal Interpolation Improves D/A Conversion

Rick LyonsRick Lyons May 28, 20121 comment

Digital interpolation can drastically simplify the analog filtering that follows a DAC, lowering cost and improving output quality. Rick Lyons explains how inserting zeros and applying a digital lowpass filter (interpolation-by-two) raises the effective sample rate, reduces the DAC sin(x)/x droop, and widens the analog filter transition band. The post gives practical intuition and spectral illustrations engineers can reuse in real designs.


A poor man's Simulink

Markus NentwigMarkus Nentwig January 24, 20153 comments

Markus Nentwig built a compact glue layer that embeds NGSPICE into Octave to cosimulate continuous-time circuits and digital control. The article walks through an RC lowpass example, the MEX-based Octave interface, and the breakpoint-driven cosimulation flow, showing how adaptive SPICE integration handles asynchronous and time-triggered events. It presents a practical, low-cost alternative to Simulink for tightly coupled analog-digital system design.


Goertzel Algorithm for a Non-integer Frequency Index

Rick LyonsRick Lyons October 7, 201325 comments

Rick Lyons demonstrates how to run the Goertzel algorithm with a non-integer frequency index k, letting you target DTFT frequencies that do not align with DFT bin centers. He interprets Rajmic and Sysel's generalization, provides a simple implementation, and presents a real-valued reformulation that reduces the final multiplies for real inputs. Example Matlab code is included to reproduce and adapt the technique.


TCP/IP interface (Matlab/Octave)

Markus NentwigMarkus Nentwig June 17, 201210 comments

Markus Nentwig supplies a compact set of mex C functions that let you control Ethernet-enabled measurement instruments directly from Matlab or Octave on Windows. The code opens raw TCP/IP sockets, sends SCPI commands, and handles ASCII and binary replies including binary-length headers. It intentionally avoids instrument-control toolboxes and timeouts for simplicity, and includes instrIf_socket, instrIf_write, instrIf_read and instrIf_close with simple usage examples.


Setting the 3-dB Cutoff Frequency of an Exponential Averager

Rick LyonsRick Lyons October 22, 20126 comments

Many engineers use a simple exponential averager but need the correct α to achieve a specified 3-dB cutoff. Rick Lyons compares a common approximation with the exact closed-form solution, shows when the approximation is valid, and derives the exact α in the appendix. The approximation works well for fc < 0.1fs, but it becomes noticeably inaccurate as the normalized cutoff increases.


Using Mason's Rule to Analyze DSP Networks

Rick LyonsRick Lyons August 31, 20096 comments

When algebra gets messy, Rick Lyons shows how Mason's Rule cuts through the tedium to produce z-domain transfer functions for even nested-feedback DSP networks. The post gives a clear step-by-step procedure, definitions, and worked examples including a biquad, a DC-bias remover, and a complex multi-loop network. It also points to a public MATLAB routine to automate the bookkeeping.