DSPRelated.com

Signed serial-/parallel multiplication

Markus NentwigMarkus Nentwig February 16, 2014

Struggling with costly wide adders for signed multiplication on FPGAs? Markus Nentwig unpacks a neat bit-level trick that turns two's-complement signed-signed multiplication into a serial-parallel routine using only a one-bit wider adder. Learn how flipping sign bits and a small, controlled constant cancel lets you avoid full sign-extension, and get a parametrized Verilog RTL plus synthesis notes to try it yourself.


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.


Understanding and Preventing Overflow (I Had Too Much to Add Last Night)

Jason SachsJason Sachs December 4, 2013

Integer overflow is stealthier than you think, and in embedded systems it can break control loops or corrupt data. Jason Sachs walks through the usual culprits, including addition, subtraction, multiplication, shifting and Q15 fixed-point traps, plus C-specific pitfalls such as undefined signed overflow and INT_MIN edge cases. He then lays out practical defenses: prefer fixed-width types, widen and saturate intermediates, enable wraparound where appropriate, and reason about modular congruence for compound arithmetic.


Finding the Best Optimum

Tim WescottTim Wescott November 4, 2013

Optimization is seductive but often misleading, especially when mathematical models don't match messy reality. Tim Wescott shares stories from circuits and communications to show how chasing the theoretical global optimum can waste time and money. He recommends framing 'best' in practical terms, validating models, and optimizing for cost and impact so products ship on time and actually work in the real world.


Computing Translated Frequencies in Digitizing and Downsampling Analog Bandpass Signals

Rick LyonsRick Lyons October 31, 20131 comment

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.


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.


Is It True That j is Equal to the Square Root of -1 ?

Rick LyonsRick Lyons September 16, 20136 comments

A viral YouTube video claimed that saying j equals the square root of negative one is wrong. Rick Lyons shows the apparent paradox comes from misusing square-root identities with negative arguments, not from the usual definition of j. He argues it is safer to define j by j^2 = -1 and illustrates how careless root operations produce contradictions in two appendices.


Signal Processing Contest in Python (PREVIEW): The Worst Encoder in the World

Jason SachsJason Sachs September 7, 20136 comments

Jason Sachs previews a hands-on Python contest to find the best velocity estimator for a noisy, low-cost quadrature encoder. The post explains the Estimator API, submission constraints, and a 5 second, 10 kHz evaluation harness that uses a simulated "Lucky Wheel" encoder with realistic manufacturing timing errors. Jason also includes a simple baseline estimator and discusses the practical tradeoff between noise reduction and phase lag in velocity estimation.


A Table of Digital Frequency Notation

Rick LyonsRick Lyons August 5, 2013

Rick Lyons compiles a compact, practical table that untangles the many algebraic frequency notations used in DSP. The reference lines up continuous and discrete sinusoid forms, shows the frequency variable names and units, and lists valid ranges and conversions like Ω = 2πf and normalized forms with fs. A printable PDF of the table is available for easy desk reference.


Shared-multiplier polyphase FIR filter

Markus NentwigMarkus Nentwig July 31, 20137 comments

One multiplier and a dual-port RAM can implement an arbitrary m/n polyphase FIR resampler on an FPGA, Markus Nentwig demonstrates. The post focuses on practical implementation details, including a parametrized Verilog design, pipelined MAC control, and a Matlab testbench for verification. It shows how bank indexing and pipeline delay compensation let you multiplex many coefficient banks efficiently for resource-constrained FPGA designs.


Modelling a Noisy Communication Signal in MATLAB for the Analog to Digital Conversion Process

Parth VakilParth Vakil October 30, 200713 comments

Practical signal modeling treats receiver noise as a fixed power source, not something tied to the transmitted waveform. Parth demonstrates why using MATLAB's awgn(sig,SNR,'measured') can misrepresent an analog front end and provides a short function that scales your signal so the added AWGN produces the desired receiver noise variance. This prepares realistic inputs for upcoming ADC simulations.


A Direct Digital Synthesizer with Arbitrary Modulus

Neil RobertsonNeil Robertson June 3, 20195 comments

Need exact sampled tones on a coarse grid without a huge sine table? This post shows how to build a Direct Digital Synthesizer with an arbitrary modulus so the output frequency is exactly k·fs/L, using a look-up table as small as 20 entries for the 10 MHz/0.5 MHz-step example. It also explains fixed-point LUT rounding, accumulator bit sizing, and how to produce quadrature outputs when L is multiple of 4.


The Zeroing Sine Family of Window Functions

Cedron DawgCedron Dawg August 16, 20202 comments

A previously unrecognized family of DFT window functions is introduced, built from products of shifted sines that deliberately zero out tail samples and control nonzero support. Cedron Dawg presents recursive and semi-root constructions, runnable code, and numerical examples, and shows that the odd-N member L=(N-1)/2 numerically matches a discrete Hermite-Gaussian DFT eigenvector. The post highlights practical properties, an even-N fix, and applications to spectrograms and tone decomposition.


Coefficients of Cascaded Discrete-Time Systems

Neil RobertsonNeil Robertson March 4, 2018

Multiplying discrete-time transfer functions is just polynomial multiplication, and polynomial multiplication is convolution. Neil Robertson shows that the numerator and denominator coefficients of cascaded systems come from convolving the individual coefficient vectors, then demonstrates the idea with MATLAB code and a 2nd-order IIR cascade that yields a 4th-order response. The approach makes computing time and frequency responses straightforward.


"Neat" Rectangular to Polar Conversion Algorithm

Rick LyonsRick Lyons November 15, 20105 comments

Rick Lyons revisits a clever slide-rule era trick for estimating the magnitude of a complex number without computing a square root. He highlights a neat identity, prompted by a Jerry Avins post, that converts the sqrt problem into forward and inverse trigonometric operations plus ratios. The post invites readers to derive Eq. (2) and see why a seemingly complex idea is actually simple and practical.


A Two Bin Solution

Cedron DawgCedron Dawg July 12, 2019

Cedron Dawg shows how a real sinusoid's frequency, amplitude and phase can be recovered from only two adjacent DFT bins. The article derives exact two-bin formulas, gives a clear Gambas reference implementation, and demonstrates that accurate parameters can be obtained with very few samples when the tone lies between the bins. It also explains when the method breaks down and how the real-valued unfurling improves robustness.


Autocorrelation and the case of the missing fundamental

Allen DowneyAllen Downey January 21, 201610 comments

A short hands-on exploration shows why we perceive the fundamental pitch even when it's absent from the spectrum. Using saxophone recordings, high-pass filtering, and autocorrelation plots, the post demonstrates that the highest ACF peak often predicts perceived pitch rather than the strongest spectral line. The experiments also show that removing high harmonics eliminates the effect, and that autocorrelation is a useful but incomplete model of pitch perception.


A Wide-Notch Comb Filter

Rick LyonsRick Lyons November 24, 201918 comments

Traditional comb filters make very narrow stopband notches, which limits their ability to suppress broader interfering tones. Rick Lyons presents a linear-phase comb filter that produces wider stopband notches than the conventional design while preserving linear-phase behavior. The post also reviews the traditional cascaded recursive running-sum architecture, its co-located dual poles and zeros on the z-plane, and the placement of nulls at integer multiples of fs/D.


Phase and Amplitude Calculation for a Pure Complex Tone in a DFT

Cedron DawgCedron Dawg January 6, 2018

Cedron Dawg derives compact, exact formulas to recover the phase and amplitude of a single complex tone from a DFT bin when the tone frequency is known. The paper turns the complex bin value into closed-form expressions using a sine-fraction amplitude correction and a simple phase shift, and includes working code plus a numeric example for direct implementation.


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.