DSPRelated.com

Canonic Signed Digit (CSD) Representation of Integers

Neil RobertsonNeil Robertson February 18, 2017

Canonic Signed Digit (CSD) encoding slashes the number of nonzero bits in integer coefficients, enabling multiplierless FIR filters implemented with shifts and adds. This post uses MATLAB code to demonstrate CSD rules, show how negative values work, and plot the distribution of signed digits as bit width changes. It finishes with practical techniques to minimize signed digits per coefficient for area and power efficient filter designs.


Matlab Code to Synthesize Multiplierless FIR Filters

Neil RobertsonNeil Robertson October 31, 20165 comments

Learn how to build multiplierless FIR lowpass filters in Matlab using Canonic Signed-Digit coefficients. The post explains converting Parks-McClellan floating-point taps to scaled integers, then to exact CSD digits, and includes two m-files that search maintap scaling to minimize signed digits while preserving the filter response. Practical notes cover external gain compensation, the 2/3 full-scale CSD limit, and sensitivity to pass/stop edges.


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.


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.


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.


Spline interpolation

Markus NentwigMarkus Nentwig May 11, 20147 comments

Markus Nentwig provides a cookbook for segmented cubic spline interpolation that turns scattered or noisy data into efficient fixed-point functions. The article shows how to build third-order polynomial segments with explicit value and slope control via basis functions, solve scaling factors by least-squares in Octave/Matlab, and export coefficients for Verilog RTL evaluation using the Horner scheme and practical fixed-point tips.


'z' as in 'Zorro': Frequency Masking FIR

Markus NentwigMarkus Nentwig October 2, 2012

Markus Nentwig shows an efficient way to build steep wideband FIR filters by combining upsampled and complementary stages, then masking their spectra. He provides a Matlab and Octave design program that uses a generic least-squares optimizer to place coefficients, letting you explore filter sizes and oversampling while cutting computational cost significantly compared to a conventional symmetric FIR.


FIR sideways (interpolator polyphase decomposition)

Markus NentwigMarkus Nentwig September 12, 20129 comments

Markus Nentwig presents a compact way to implement a symmetric FIR interpolator by rethinking the usual tapped delay line. The 1:3 polyphase example uses separate delay lines per coefficient to skip multiplies on known zeros and exploit symmetry, cutting multiplications substantially; a Matlab/Octave demo and notes on ASIC-friendly implementation are included to help evaluate real-world cost tradeoffs.


Design of an anti-aliasing filter for a DAC

Markus NentwigMarkus Nentwig August 18, 2012

If you need a practical way to design an anti-aliasing filter for a DAC, this post delivers an Octave/Matlab script that numerically optimizes a Laplace-domain transfer function for linear phase and arbitrary magnitude. The routine models the DAC sample-and-hold sinc response, compensates group delay automatically, and can include an optional multiplierless FIR equalizer. An example shows a 5.4 dB objective improvement and reduced analog Q for easier implementation.


Python number crunching faster? Part I

Christopher FeltonChristopher Felton September 17, 20114 comments

Christopher Felton walks through simple benchmarks comparing raw Python, numpy, and PyPy for numeric workloads, and shares what surprised him about performance. He shows that idiomatic Python optimizations such as list comprehensions and built-ins plus the PyPy JIT can sometimes beat a numpy approach for small tests, and explains why native PyPy numpy progress matters for scientific users.


Learn About Transmission Lines Using a Discrete-Time Model

Neil RobertsonNeil Robertson January 12, 20222 comments

A simple discrete-time approach makes lossless transmission-line behavior easy to simulate and visualize. The post introduces MATLAB functions tline and wave_movie to model uniform lossless lines with resistive terminations, compute time and frequency responses, and animate travelling waves. A microstrip pulse example shows how reflections produce ringing and how source matching nearly eliminates it, making this a practical learning tool.


Instant CIC

Markus NentwigMarkus Nentwig May 8, 20124 comments

Modeling CIC decimators in floating point is simpler than you might think, Markus Nentwig shows, if you treat the filter as a finite FIR by sampling its impulse response. The post compares a naive float time-domain implementation, an FFT-based frequency-domain approach, and the recommended method of computing the impulse response and using an off-the-shelf FIR filter, with code and plots.


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.


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.


Simulink-Simulation of SSB demodulation

Josef HoffmannJosef Hoffmann June 13, 20211 comment

This post walks through Simulink models that implement SSB demodulation and modulation, using Richard Lyons' phasing method as a foundation. It shows practical models for simple carrier multiplication and for the phasing method with cosine and -sin paths plus Hilbert filtering, and it highlights sampling, decimation, filter choices, and delay alignment to make the techniques work in simulation.


Decimators Using Cascaded Multiplierless Half-band Filters

Neil RobertsonNeil Robertson November 19, 2023

In my last post, I provided coefficients for several multiplierless half-band FIR filters. In the comment section, Rick Lyons mentioned that such filters would be useful in a multi-stage decimator. For such an application, any subsequent multipliers save on resources, since they operate at a fraction of the maximum sample frequency. We’ll examine the frequency response and aliasing of a multiplierless decimate-by-8 cascade in this article, and we’ll also discuss an interpolator cascade using the same half-band filters.


A Matlab Function for FIR Half-Band Filter Design

Neil RobertsonNeil Robertson July 6, 20259 comments

FIR Half-band filters are not difficult to design. In an earlier post [1], I showed how to design them using the window method. Here, I provide a short Matlab function halfband_synth that uses the Parks-McClellan algorithm (Matlab function firpm [2]) to synthesize half-band filters. Compared to the window method, this method uses fewer taps to achieve a given performance.


The First-Order IIR Filter -- More than Meets the Eye

Neil RobertsonNeil Robertson November 16, 20257 comments

While we might be inclined to disdain the simple first-order infinite impulse response (IIR) filter, it is not so simple that we can’t learn something from it. Studying it can teach DSP math skills, and it is a very useful filter in its own right. In this article, we’ll examine the time response of the filter, compare the first-order IIR filter to the FIR moving average filter, use it to smooth a noisy signal, compute the functional form of the impulse response, and find the frequency response.


Radio Frequency Distortion Part II: A power spectrum model

Markus NentwigMarkus Nentwig October 11, 20101 comment

Markus Nentwig presents a power-spectrum model that predicts RF nonlinear distortion from spectral power values instead of time-domain signals. The model computes distortion as repeated convolutions with a frequency-reversed replica and uses an FFT/IFFT trick with real-valued arithmetic for very high efficiency, making it suitable for system-level simulations and interference-aware radios. It is accurate for OFDM-like, Gaussian-amplitude signals when spectral binning is sufficiently fine; narrowband cases require denser bins.