Markus Nentwig (@mnentwig)

Markus received his Dipl. Ing. degree in electrical engineering / communications in 1999. Work interests include RF transceiver system design, implementation, modeling, verification and nowadays production testing. He works for Qualcomm in Munich.

A poor man's Simulink

Markus Nentwig January 24, 20153 comments

Glue between Octave and NGSPICE for discrete- and continuous time cosimulation (download) Keywords: Octave, SPICE, Simulink


Many DSP problems have close ties with the analog world. For example, a switched-mode audio power amplifier uses a digital control loop to open and close power transistors driving an analog filter. There are commercial tools for digital-analog cosimulation: Simulink comes to mind, and mainstream EDA vendors support VHDL-AMS or Verilog-A in their...

Spline interpolation

Markus Nentwig May 11, 20147 comments

A cookbook recipe for segmented y=f(x) 3rd-order polynomial interpolation based on arbitrary input data. Includes Octave/Matlab design script and Verilog implementation example. Keywords: Spline, interpolation, function modeling, fixed point approximation, data fitting, Matlab, RTL, Verilog


Splines describe a smooth function with a small number of parameters. They are well-known for example from vector drawing programs, or to define a "natural" movement path through given...

Signed serial-/parallel multiplication

Markus Nentwig February 16, 2014

Keywords: Binary signed multiplication implementation, RTL, Verilog, algorithm

  • A detailed discussion of bit-level trickstery in signed-signed multiplication
  • Algorithm based on Wikipedia example
  • Includes a Verilog implementation with parametrized bit width
Signed serial-/parallel multiplication

A straightforward method to multiply two binary numbers is to repeatedly shift the first argument a, and add to a register if the corresponding bit in the other argument b is set. The...

Shared-multiplier polyphase FIR filter

Markus Nentwig July 31, 20136 comments

Keywords: FPGA, interpolating decimating FIR filter, sample rate conversion, shared multiplexed pipelined multiplier

Discussion, working code (parametrized Verilog) and Matlab reference design for a FIR polyphase resampler with arbitrary interpolation and decimation ratio, mapped to one multiplier and RAM.


A polyphase filter can be as straightforward as multirate DSP ever gets, if it doesn't turn into a semi-deterministic, three-legged little dance between input, output and...

Noise shaping

Markus Nentwig December 9, 20123 comments

eywords: Quantization noise; noise shaping

A brief introduction to noise shaping, with firm resolve not to miss the forest for the trees. We may still stumble over some assorted roots. Matlab example code is included.


Fig. 1 shows a digital signal that is reduced to a lower bit width, for example a 16 bit signal being sent to a 12 bit digital-to-analog converter. Rounding to the nearest output value is obviously the best that can be done to minimize the error of each...

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

Markus Nentwig October 2, 2012

An efficient way to implement FIR filters. Matlab / Octave example included. Keywords: Frequency masking FIR filter implementation


An "upsampled" FIR filter uses multiple-sample delays between the taps, compared to the unity delays in a conventional FIR filter. The resulting frequency response has steeper edges, but contains periodic images along the frequency axis (Fig. 1). Due to the latter, it is typically not too useful on its own.

Figure 1: Conventional and 'upsampled'...

FIR sideways (interpolator polyphase decomposition)

Markus Nentwig September 12, 20129 comments

An efficient implementation of a symmetric-FIR polyphase 1:3 interpolator that doesn't follow the usual tapped delay line-paradigm. The example exploits the impulse response symmetry and avoids four multiplications out of 10. keywords: symmetric polyphase FIR filter implementation ASIC Matlab / Octave implementation


An interpolating FIR filter can be implemented with a single tapped delay line, possibly going forwards and backwards for a symmetric impulse response. To...

Design of an anti-aliasing filter for a DAC

Markus Nentwig August 18, 2012
  • Octaveforge / Matlab design script. Download: here
  • weighted numerical optimization of Laplace-domain transfer function
  • linear-phase design, optimizes vector error (magnitude and phase)
  • design process calculates and corrects group delay internally
  • includes sinc() response of the sample-and-hold stage in the ADC
  • optionally includes multiplierless FIR filter
Problem Figure 1: Typical FIR-DAC-analog lowpass line-up

Digital-to-analog conversion connects digital...

TCP/IP interface (Matlab/Octave)

Markus Nentwig June 17, 201210 comments

Communicate with measurement instruments via Ethernet (no-toolbox-Matlab or Octave)


Measurement automation is digital signal processing in a wider sense: Getting a digital signal from an analog world usually involves some measurement instruments, for example a spectrum analyzer. Modern instruments, and also many off-the-shelf prototyping boards such as FPGA cards [1] or microcontrollers [2] are able to communicate via Ethernet. Here, I provide some basic mex-functions (compiled C...

Weighted least-squares FIR with shared coefficients

Markus Nentwig May 23, 2012

FIR design with arbitrary routing between delay line and coefficient multipliers.

Includes a commented implementation of a generic IRLS FIR design algorithm.

Introduction: Reverse Engineering

While looking for numerical IIR filter optimization, a Matlab program in [1] for the design of FIR filters caught my attention. The equations looked familiar, sort of, but on closer examination the pieces refused to fit together. Without the references, it took about two evenings to sort out how it...

Instant CIC

Markus Nentwig May 8, 20124 comments


A floating point model for a CIC decimator, including the frequency response.


A CIC filter relies on a peculiarity of its fixed-point implementation: Normal operation involves repeated internal overflows that have no effect to the output signal, as they cancel in the following stage.

One way to put it intuitively is that only the speed (and rate of change) of every little "wheel" in the clockworks carries information, but its absolute position is...

Design study: 1:64 interpolating pulse shaping FIR

Markus Nentwig December 26, 20115 comments

This article is the documentation to a code snippet that originated from a discussion on comp.dsp.

The task is to design a root-raised cosine filter with a rolloff of a=0.15 that interpolates to 64x the symbol rate at the input.

The code snippet shows a solution that is relatively straightforward to design and achieves reasonably good efficiency using only FIR filters.

Motivation: “simple solutions?”

Bank-switched Farrow resampler

Markus Nentwig August 13, 20113 comments
Bank-switched Farrow resampler Summary

A modification of the Farrow structure with reduced computational complexity.Compared to a conventional design, the impulse response is broken into a higher number of segments. Interpolation accuracy is achieved with a lower polynomial order, requiring fewer multiplications per output sample at the expense of a higher overall number of coefficients.

Example code

This code snippet provides a Matlab / Octave implementation.And

A multiuser waterfilling algorithm

Markus Nentwig November 5, 20101 comment

Hello,this blog entry documents a code snippet for a multi-user waterfilling algorithm. It's heuristic and relatively straightforward, making it easy to implement additional constraints or rules.I rewrote parts of it to improve readability, but no extensive testing took place afterwards. Please double-check that it does what it promises.

Introduction to multiuser waterfilling.

Background information can be found for example in the presentation from Yosia Hadisusanto,

Least-squares magic bullets? The Moore-Penrose Pseudoinverse

Markus Nentwig October 24, 20109 comments


the topic of this brief article is a tool that can be applied to a variety of problems: The Moore-Penrose Pseudoinverse.While maybe not exactly a magic bullet, it gives us least-squares optimal solutions, and that is under many circumstances the best we can reasonably expect.

I'll demonstrate its use on a short example. More details can be found for example on Wikipedia, or the Matlab documentation...

Radio Frequency Distortion Part II: A power spectrum model

Markus Nentwig October 11, 20101 comment

This article presents a ready-to-use model for nonlinear distortion caused by radio frequenfcy components in wireless receivers and linear transmitters. Compared to the similar model presented in my earlier blog entry, it operates on expectation values of the the power spectrum instead of the signal itself: Use the signal-based model to generate distortion on a signal, and the one from this article to directly obtain the power spectrum much more efficiently.In...

Understanding Radio Frequency Distortion

Markus Nentwig September 26, 20102 comments

The topic of this article are the effects of radio frequency distortions on a baseband signal, and how to model them at baseband. Typical applications are use as a simulation model or in digital predistortion algorithms.


Transmitting and receiving wireless signals usually involves analog radio frequency circuits, such as power amplifiers in a transmitter or low-noise amplifiers in a receiver.Signal distortion in those circuits deteriorates the link quality. When...

A brief look at multipath radio channels

Markus Nentwig October 31, 20078 comments

Summary: Discussion of multipath propagation and fading in radio links

Radio channels, their effects on communications links and how to model them are a popular topic on comp.dsp. Unfortunately, for many of us there is little or no opportunity to get any "hands-on" experience with radio-related issues, because the required RF measurement equipment is not that easily available.

This article gives a very simple example of a radio link that shows multipath propagation and...

Delay estimation by FFT

Markus Nentwig September 22, 200750 comments
Given x=sig(t) and y=ref(t), returns [c, ref(t+delta), delta)] = fitSignal(y, x);:Estimates and corrects delay and scaling factor between two signals Code snippet

This article relates to the Matlab / Octave code snippet: Delay estimation with subsample resolution It explains the algorithm and the design decisions behind it.


There are many DSP-related problems, where an unknown timing between two signals needs to be determined and corrected, for example, radar, sonar,...

Polyphase filter / Farrows interpolation

Markus Nentwig September 18, 200714 comments


this article is meant to give a quick overview over polyphase filtering and Farrows interpolation.

A good reference with more depth is for example Fred Harris' paper:

The task is as follows: Interpolate a band-limited discrete-time signal at a variable offset between samples.In other words:Delay the signal by a given amount with sub-sample accuracy.Both mean the same.

The picture below shows samples (black) representing...

Through the tube...

Markus Nentwig September 15, 20073 comments

Hello all,

something completely different...

there was some recent discussion on the forum about modeling guitar amplifiers.I have been wondering for quite a while, whether the methods that I use to model radio frequency power amplifiers might also work for audio applications.

It's been a rainy day, so I found the time and energy for some experiments. Just for fun.

The device-under-test is a preamplifier with a single 12AX7 tube:

My good ol' Kurzweil (not in the picture) serves as "signal...

No Threads Found

Use this form to contact mnentwig

Before you can contact a member of the *Related Sites:

  • You must be logged in (register here)
  • You must confirm you email address