An Alternative Form of the Pure Real Tone DFT Bin Value Formula
Cedron Dawg derives an alternative exact formula for DFT bin values of a pure real tone, sacrificing algebraic simplicity for better numerical behavior near integer-valued frequencies. By rewriting cosine differences as products of sines and shifting to a delta frame of reference, the derivation avoids catastrophic cancellation and preserves precision for near-integer tones. The analysis also shows the integer-frequency case is a degenerate limit that yields the familiar M/2 e^{iφ} bin value.
Design IIR Butterworth Filters Using 12 Lines of Code
Build a working lowpass IIR Butterworth filter from first principles in just 12 lines of Matlab using Neil Robertson's butter_synth.m. The post walks through the analog prototype poles, frequency pre-warping, bilinear transform pole mapping, adding N zeros at z = -1, and gain normalization so the result matches Matlab's built-in butter function. It's a compact, hands-on guide with clear formulas and code.
Simplest Calculation of Half-band Filter Coefficients
Half-band FIR filters put the cutoff at one-quarter of the sampling rate, and nearly half their coefficients are exactly zero, which makes them highly efficient for decimation-by-2 and interpolation-by-2. This post shows the straightforward window-method derivation of half-band coefficients from the ideal sinc impulse response, providing a clear, hands-on explanation for engineers learning filter design. It also points to equiripple options such as Matlab's firhalfband and a later Parks-McClellan implementation.
Improved Three Bin Exact Frequency Formula for a Pure Real Tone in a DFT
Cedron Dawg extends his two-bin exact frequency formulas to a three-bin DFT estimator for a pure real tone, and presents the derivation in computational order for practical use. The method splits complex bin values into real and imaginary parts, forms vectors A, B, and C, applies a sqrt(2) variance rescaling, and computes frequency via a projection-based closed form. Numerical tests compare the new formula to prior work and show improved accuracy when the tone lies between bins.
There and Back Again: Time of Flight Ranging between Two Wireless Nodes
Conventional timestamping seems too coarse for centimeter-level RF ranging, yet many products claim and deliver that precision. This post unpacks the fundamentals behind high-resolution wireless ranging, contrasting common RF approaches such as RSSI, ToA, PoA, TDoA, and AoA. It also explains how device timestamps and counter registers work, giving engineers a practical starting point for implementing or evaluating time-of-flight ranging systems.
Two Bin Exact Frequency Formulas for a Pure Real Tone in a DFT
Cedron Dawg derives exact, closed-form frequency formulas that recover a pure real tone from just two DFT bins using a geometric vector approach. The method projects bin-derived vectors onto a plane orthogonal to a constraint vector to eliminate amplitude and phase, yielding an explicit cos(alpha) estimator; a small adjustment improves noise performance so the estimator rivals and slightly betters earlier two-bin methods.
Exact Near Instantaneous Frequency Formulas Best at Zero Crossings
Cedron Dawg derives time-domain formulas that yield near-instantaneous frequency estimates optimized for zero crossings of pure tones. Complementing his earlier peak-optimized results, these difference-ratio formulas work for real and complex signals, produce four-sample estimators similar to Turners, and cancel amplitude terms, making them attractive low-latency options for clean tones while warning they degrade in noise and at peaks.
Exact Near Instantaneous Frequency Formulas Best at Peaks (Part 2)
Cedron Dawg derives a second family of exact time domain formulas for single-tone frequency estimation that trade a few extra calculations for improved noise robustness. Built from [1+cos]^k binomial weighting of neighbor-pair sums, the closed-form estimators are exact and are best evaluated at signal peaks for real tones, while complex tones do not share the zero-crossing limitation. Coefficients up to k=9 are provided.
Modeling a Continuous-Time System with Matlab
Neil Robertson demonstrates a practical workflow for converting a continuous-time transfer function H(s) into an exact discrete-time H(z) using Matlab's impinvar. He walks through a 3rd-order Butterworth example, shows how to match impulse and step responses, and compares frequency response and group delay so engineers can see where the discrete model stays accurate and when sampling-rate limits cause departure.
How to Find a Fast Floating-Point atan2 Approximation
This post shows how a compact, fast atan2 can be built from a Remez-derived arctangent approximation and a matching 3rd-order polynomial. It walks through using Boost's remez_minimax to recover coefficients 0.97239411 and -0.19194795, integrating the polynomial into an atan2 with quadrant reduction, and applying branch reduction, bit tricks, and SSE2 SIMD to cut runtime while keeping max error under about 0.005 radians.
Discrete-Time PLLs, Part 1: Basics
In this series of tutorials on discrete-time PLLs we will be focusing on Phase-Locked Loops that can be implemented in discrete-time signal proessors such as FPGAs, DSPs and of course, MATLAB.
An s-Plane to z-Plane Mapping Example
A misleading online diagram prompted Rick Lyons to reexamine how s-plane points map to the z-plane. He spotted apparent errors in the original figure, drew a corrected mapping, and invites readers to inspect both diagrams and point out any remaining mistakes. The short post is a quick visual primer for engineers who rely on accurate s-plane to z-plane mappings in analysis and design.
Design IIR Highpass Filters
Neil Robertson walks through a compact, six-step procedure to synthesize IIR Butterworth highpass filters using pre-warping and the bilinear transform. The post gives the pole transformations, the placement of N zeros at z=1, the scaling to unity gain at fs/2, and a ready-to-run MATLAB hp_synth implementation that reproduces MATLAB's butter results.
Compute Modulation Error Ratio (MER) for QAM
Neil Robertson shows how to define and compute Modulation Error Ratio (MER) for QAM using a simplified baseband model and decision-slice errors. The post derives per-symbol and averaged MER formulas, explains when MER tracks carrier-to-noise ratio under AWGN and matched root-Nyquist filters, and provides example Pav values for QAM-16 and QAM-64 plus a Matlab script and practical tips.
Phase and Amplitude Calculation for a Pure Complex Tone in a DFT using Multiple Bins
Cedron presents exact, closed-form formulas to extract the phase and amplitude of a pure complex tone from multiple DFT bin values, using a compact vector formulation. The derivation introduces a delta variable to simplify the sinusoidal bin expression, stacks neighboring bins into a basis vector, and solves for the complex amplitude q by projection. The phase and magnitude follow directly from q, and extra bins reduce leakage when the tone falls between bins.
Phase and Amplitude Calculation for a Pure Real Tone in a DFT: Method 1
Cedron Dawg shows how to get exact amplitude and phase for a real sinusoid whose frequency does not land on an integer DFT bin. The method treats a small neighborhood of DFT bins as a complex vector, builds two basis vectors from the cosine and sine transforms, and solves a 2x2 system using conjugate dot products to recover real coefficients that give amplitude and phase. A C++ example and sample output verify the formulas.
Pentagon Construction Using Complex Numbers
A method for constructing a pentagon using a straight edge and a compass is deduced from the complex values of the Fifth Roots of Unity. Analytic values for the points are also derived.
The Discrete Fourier Transform of Symmetric Sequences
Symmetric sequences arise often in digital signal processing. Examples include symmetric pulses, window functions, and the coefficients of most finite-impulse response (FIR) filters, not to mention the cosine function. Examining symmetric sequences can give us some insights into the Discrete Fourier Transform (DFT). An even-symmetric sequence is centered at n = 0 and xeven(n) = xeven(-n). The DFT of xeven(n) is real. Most often, signals we encounter start at n = 0, so they are not strictly speaking even-symmetric. We’ll look at the relationship between the DFT’s of such sequences and those of true even-symmetric sequences.
ADC Clock Jitter Model, Part 2 – Random Jitter
Neil Robertson shows how to simulate ADC sample-clock random jitter in Matlab, moving from band-limited Gaussian noise to wideband and close-in phase noise. The post highlights practical artifacts such as aliasing of wideband clock noise, the 20*log10 dependence of jitter sidebands on input frequency, and why cubic interpolation plus a custom noise_filter produces accurate rms and spectral results engineers can trust.
DFT Graphical Interpretation: Centroids of Weighted Roots of Unity
DFT bin values can be seen as centroids of weighted roots of unity, a geometric picture that makes many DFT properties immediate. Cedron Dawg uses the geometric-series identity and polar plots of integer and fractional tones to show why constants appear only at DC, how wrapping relates to bin index, and how phase, scaling, offsets, and real-signal symmetry affect bin magnitudes and angles.
Computing Translated Frequencies in Digitizing and Downsampling Analog Bandpass Signals
Textbooks rarely give ready formulas for tracking where individual spectral lines land after bandpass sampling or decimation. Rick Lyons provides three concise equations, with Matlab code, that compute translated frequencies for analog bandpass sampling, real digital downsampling, and complex downsampling. Practical examples show how to place the sampled image at fs/4 and how to translate a complex bandpass to baseband for efficient demodulation.
How the Cooley-Tukey FFT Algorithm Works | Part 1 - Repeating Calculations
The Fourier Transform is a powerful tool, used in many technologies, from audio processing to wireless communication. However, calculating the FT can be computationally expensive. The Cooley-Tukey Fast Fourier Transform (FFT) algorithm provides a significant speedup. It exploits the repetitive nature of calculations within the Discrete Fourier Transform (DFT), the mathematical foundation of the FT. By recognizing patterns in the DFT calculations and reusing intermediate results, the FFT vastly reduces the number of operations required. In this series of articles, we will look at how the Cooley-Tukey FFT algorithm works.
Multimedia Processing with FFMPEG
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.
Modeling Anti-Alias Filters
Modeling anti-alias filters brings textbook aliasing examples to life. This post shows how to build discrete-time models G(z) for analog Butterworth and Chebyshev lowpass anti-alias filters, compares bilinear transform and impulse invariance, and simulates ADC input/output including aliasing of sinusoids and Gaussian noise. It concludes that impulse invariance gives better stopband accuracy and includes Matlab helper functions.
How the Cooley-Tukey FFT Algorithm Works | Part 4 - Twiddle Factors
The beauty of the FFT algorithm is that it does the same thing over and over again. It treats every stage of the calculation in exactly the same way. However, this. “one-size-fits-all” approach, although elegant and simple, causes a problem. It misaligns samples and introduces phase distortions during each stage of the algorithm. To overcome this, we need Twiddle Factors, little phase correction factors that push things back into their correct positions before continuing onto the next stage.
Modeling a Continuous-Time System with Matlab
Neil Robertson demonstrates a practical workflow for converting a continuous-time transfer function H(s) into an exact discrete-time H(z) using Matlab's impinvar. He walks through a 3rd-order Butterworth example, shows how to match impulse and step responses, and compares frequency response and group delay so engineers can see where the discrete model stays accurate and when sampling-rate limits cause departure.
Exponential Smoothing with a Wrinkle
Cedron Dawg shows how pairing forward and backward exponential smoothing produces exact, frequency-dependent dampening for sinusoids while canceling time-domain lag. The average of the two passes scales the tone by a closed-form factor, and their difference acts like a first-derivative with a quarter-cycle phase shift. The post derives the analytic dampening formulas, compares them to the derivative, and includes a Python demo for DFT preprocessing.
Learn to Use the Discrete Fourier Transform
Discrete-time sequences arise in many ways: a sequence could be a signal captured by an analog-to-digital converter; a series of measurements; a signal generated by a digital modulator; or simply the coefficients of a digital filter. We may wish to know the frequency spectrum of any of these sequences. The most-used tool to accomplish this is the Discrete Fourier Transform (DFT), which computes the discrete frequency spectrum of a discrete-time sequence. The DFT is easily calculated using software, but applying it successfully can be challenging. This article provides Matlab examples of some techniques you can use to obtain useful DFT’s.
Generating Partially Correlated Random Variables
Designing signals to match a target covariance is simpler than it sounds. This post shows how to build partially correlated complex signals by hand for the two-signal case, then generalizes to N signals using the Cholesky decomposition. Short MATLAB examples demonstrate the two-line implementation and the article highlights numerical caveats when a covariance is only positive semidefinite.
Add the Hilbert Transformer to Your DSP Toolkit, Part 2
This post shows a simple practical route to a Hilbert transformer by starting from a half-band FIR filter and tweaking its symmetry. It walks through a 19-tap example synthesized with Matlab's firpm (Parks-McClellan), explains the required frequency scaling, and shows how even-numbered taps become (or can be forced) zero through symmetry and coefficient quantization. Useful design rules are summarized for choosing ntaps.















