DSPRelated.com
Tutorials

The Power Spectrum

Neil RobertsonNeil Robertson October 8, 2016

You can get absolute power from a DFT, not just relative spectra. In this post Neil Robertson shows how to convert FFT outputs into watts per bin using Parseval's theorem, how to form one-sided spectra, and how to normalize windows so power is preserved. Matlab examples demonstrate bin-centered and between-bin sinusoids, leakage, scalloping, and how to recover component power by summing bins.


Wavelets I - From Filter Banks to the Dilation Equation

Vincent HerrmannVincent Herrmann September 28, 20169 comments

Starting from a practical cascaded FIR filter bank, this post derives the key equations behind the Fast Wavelet Transform. It shows how conjugate-quadrature analysis and synthesis filters give perfect reconstruction and how iterating the cascade produces the scaling function, leading to the dilation equation. DB4 coefficients are used as a concrete example and a linear-system trick yields exact integer-sample values of the scaling function.


An s-Plane to z-Plane Mapping Example

Rick LyonsRick Lyons September 24, 201610 comments

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.


Digital PLL's -- Part 2

Neil RobertsonNeil Robertson June 15, 20165 comments

Neil Robertson builds a Z-domain model of a second-order digital PLL with a proportional-plus-integral loop filter, then derives closed-form formulas for KL and KI from the desired loop natural frequency and damping. The post explains the s → (z - 1)/Ts approximation, shows how to form the closed-loop IIR CL(z) for step and frequency responses, and highlights when the linear Z-domain model falls short of nonlinear acquisition behavior.


Digital PLL's -- Part 1

Neil RobertsonNeil Robertson June 7, 201626 comments

A hands-on introduction to time-domain digital phase-locked loops, Neil Robertson builds a simple DPLL model in MATLAB and walks through the NCO, phase detector, and PI loop filter implementations. The post uses phase-in-cycles arithmetic to show how the phase accumulator, detector wrapping, and loop filter interact, and it contrasts linear steady-state behavior with the nonlinear acquisition seen when initial frequency error is large. Part 2 will cover frequency-domain tuning of the loop gains.


Peak to Average Power Ratio and CCDF

Neil RobertsonNeil Robertson May 17, 20164 comments

Setting digital modulator levels depends on peak-to-average power ratio, because random signals produce occasional high peaks that cause clipping. This post shows how to compute the CCDF of PAPR from a signal vector, with MATLAB code and examples for a sine wave and Gaussian noise. The examples reveal the fixed 3.01 dB PAPR of a sine and the need for large sample counts to capture rare AWGN peaks.


Filter a Rectangular Pulse with no Ringing

Neil RobertsonNeil Robertson May 12, 201610 comments

You can filter a rectangular pulse with no ringing simply by using an FIR whose coefficients are all positive, and make them symmetric to get identical leading and trailing edges. This post walks through a MATLAB example that convolves a normalized Hanning window with a 32-sample rectangular pulse, showing that window length controls edge duration and that shorter windows widen the spectrum. It also notes this is not a QAM pulse-shaping solution.


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

Rick LyonsRick Lyons April 3, 201623 comments

Envelope detection sounds simple, but implementation choices change everything. Rick Lyons gathers common digital detectors, including half-wave, full-wave, square-law, Hilbert-based complex, and synchronous coherent designs, and explains how harmonics, filtering, and carrier recovery change results. He ranks detectors by output SNR from a representative simulation and offers practical tips on filter cutoff, Hilbert transformer bandwidth, and when a simple detector is good enough.


Exponential Smoothing with a Wrinkle

Cedron DawgCedron Dawg December 17, 20154 comments

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.


Discrete-Time PLLs, Part 1: Basics

Reza AmeliReza Ameli December 1, 20159 comments

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.


Filter a Rectangular Pulse with no Ringing

Neil RobertsonNeil Robertson May 12, 201610 comments

You can filter a rectangular pulse with no ringing simply by using an FIR whose coefficients are all positive, and make them symmetric to get identical leading and trailing edges. This post walks through a MATLAB example that convolves a normalized Hanning window with a 32-sample rectangular pulse, showing that window length controls edge duration and that shorter windows widen the spectrum. It also notes this is not a QAM pulse-shaping solution.


How the Cooley-Tukey FFT Algorithm Works | Part 3 - The Inner Butterfly

Mark NewmanMark Newman November 25, 2024

At the heart of the Cooley-Tukey FFT algorithm lies a butterfly, a simple yet powerful image that captures the recursive nature of how the FFT works. In this article we discover the butterfly’s role in transforming complex signals into their frequency components with efficiency and elegance. Starting with the 2-point DFT, we reveal how the FFT reuses repeated calculations to save time and resources. Using a divide-and-conquer approach, the algorithm breaks signals into smaller groups, processes them through interleaving butterfly diagrams, and reassembles the results step by step.


Frequency Formula for a Pure Complex Tone in a DTFT

Cedron DawgCedron Dawg November 12, 2023

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.


FIR Filter to Match Any Magnitude and Phase Response

Dan BoschenDan Boschen September 30, 20252 comments

This post details a technique for designing high quality FIR filters that match arbitrary magnitude and phase responses.


A Two Bin Exact Frequency Formula for a Pure Complex Tone in a DFT

Cedron DawgCedron Dawg March 20, 20179 comments

Cedron Dawg derives an exact two-bin frequency formula for a pure complex tone in the DFT, eliminating amplitude and phase to isolate frequency via a complex quotient and the complex logarithm. He presents an adjacent-bin simplification that replaces a complex multiply with a bin offset plus an atan2 angle, and discusses integer-frequency handling and aliasing. C source and numerical examples show the formula working in practice.


Three Bin Exact Frequency Formulas for a Pure Complex Tone in a DFT

Cedron DawgCedron Dawg April 13, 20171 comment

Cedron Dawg derives closed-form three-bin frequency estimators for a pure complex tone in a DFT using a linear algebra view that treats three adjacent bins as a vector. He shows any vector K orthogonal to [1 1 1] yields a = (K·Z)/(K·D·Z) and derives practical K choices including a Von Hann (Pascal) kernel and a data-driven projection. The post compares estimators under noise and gives simple selection rules.


The Discrete Fourier Transform of Symmetric Sequences

Neil RobertsonNeil Robertson December 8, 2024

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.


DFT Bin Value Formulas for Pure Complex Tones

Cedron DawgCedron Dawg March 17, 2017

Cedron Dawg derives closed-form DFT bin formulas for single complex exponentials, eliminating the need for brute-force summation and showing how phase acts as a uniform rotation of all bins. He also gives a Dirichlet-kernel form that yields the magnitude as (M/N)|sin(δN/2)/sin(δ/2)|, explains the large-N sinc limit, and includes C code to verify the results.


Approximating the area of a chirp by fitting a polynomial

Alexandre de SiqueiraAlexandre de Siqueira November 15, 20158 comments

Once in a while we need to estimate the area of a dataset in which we are interested. This area could give us, for example, force (mass vs acceleration) or electric power (electric current vs charge).


Phase and Amplitude Calculation for a Pure Complex Tone in a DFT using Multiple Bins

Cedron DawgCedron Dawg March 14, 201812 comments

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.