## Matlab Code to Synthesize Multiplierless FIR Filters

This article presents Matlab code to synthesize multiplierless Finite Impulse Response (FIR) lowpass filters.

A filter coefficient can be represented as a sum of powers of 2.  For example, if a coefficient = decimal 5 multiplies input x, the output is $y= 2^2*x + 2^0*x$.  The factor of $2^2$ is then implemented with a shift of 2 bits.  This method is not efficient for coefficients having a lot of 1’s, e.g. decimal 31 = 11111.  To reduce the number of non-zero...

## The Power Spectrum

October 8, 2016

Often, when calculating the spectrum of a sampled signal, we are interested in relative powers, and we don’t care about the absolute accuracy of the y axis.  However, when the sampled signal represents an analog signal, we sometimes need an accurate picture of the analog signal’s power in the frequency domain.  This post shows how to calculate an accurate power spectrum.

Parseval’s theorem [1,2] is a property of the Discrete Fourier Transform (DFT) that...

## Digital PLL's -- Part 2

In Part 1, we found the time response of a 2nd order PLL with a proportional + integral (lead-lag) loop filter.  Now let’s look at this PLL in the Z-domain [1, 2].  We will find that the response is characterized by a loop natural frequency ωn and damping coefficient ζ.

Having a Z-domain model of the DPLL will allow us to do three things:

Compute the values of loop filter proportional gain KL and integrator gain KI that give the desired loop natural...

## Digital PLL's -- Part 1

1. Introduction

Figure 1.1 is a block diagram of a digital PLL (DPLL).  The purpose of the DPLL is to lock the phase of a numerically controlled oscillator (NCO) to a reference signal.  The loop includes a phase detector to compute phase error and a loop filter to set loop dynamic performance.  The output of the loop filter controls the frequency and phase of the NCO, driving the phase error to zero.

One application of the DPLL is to recover the timing in a digital...

## Peak to Average Power Ratio and CCDF

Peak to Average Power Ratio (PAPR) is often used to characterize digitally modulated signals.  One example application is setting the level of the signal in a digital modulator.  Knowing PAPR allows setting the average power to a level that is just low enough to minimize clipping.

However, for a random signal, PAPR is a statistical quantity.  We have to ask, what is the probability of a given peak power?  Then we can decide where to set the average...

## Filter a Rectangular Pulse with no Ringing

To filter a rectangular pulse without any ringing, there is only one requirement on the filter coefficients:  they must all be positive.  However, if we want the leading and trailing edge of the pulse to be symmetrical, then the coefficients must be symmetrical.  What we are describing is basically a window function.

Consider a rectangular pulse 32 samples long with fs = 1 kHz.  Here is the Matlab code to generate the pulse:

N= 64; fs= 1000; % Hz sample...

## Add a Power Marker to a Power Spectral Density (PSD) Plot

February 7, 2021

Perhaps we should call most Power Spectral Density (PSD) calculations relative PSD, because usually we don’t have to worry about absolute power levels.  However, for cases (e.g., measurements or simulations) where we are concerned with absolute power, it would be nice to be able to display it on a PSD plot.  Unfortunately, you can’t read the power directly from the plot.  For example, the plotted spectral peak of a narrowband signal, such as a sinewave, is lower than the...

## Digital Filter Instructions from IKEA?

Swedish “Bygglek” = build and play.   Swedish “Bygglek” = build and play.

Swedish “Bygglek” = build and play.  Swedish “Bygglek” = build and play.

Swedish “Bygglek” = build and play.  Swedish “Bygglek” = build and play.

Swedish “Bygglek” = build and play.  Swedish “Bygglek” = build and play.

Swedish “Bygglek” = build and play.  Swedish “Bygglek” = build and...

## Learn About Transmission Lines Using a Discrete-Time Model

January 12, 2022

We don’t often think about signal transmission lines, but we use them every day.  Familiar examples are coaxial cable, Ethernet cable, and Universal Serial Bus (USB).  Like it or not, high-speed clock and signal traces on printed-circuit boards are also transmission lines.

While modeling transmission lines is in general a complex undertaking, it is surprisingly simple to model a lossless, uniform line with resistive terminations by using a discrete-time approach.  A...

## Find Aliased ADC or DAC Harmonics (with animation)

January 11, 2021

When a sinewave is applied to a data converter (ADC or DAC), device nonlinearities produce harmonics.  If a harmonic frequency is greater than the Nyquist frequency, the harmonic appears as an alias.  In this case, it is not at once obvious if a given spur is a harmonic, and if so, its order.  In this article, we’ll present Matlab code to simulate the data converter nonlinearities and find the harmonic alias frequencies.  Note that Analog Devices has an online tool for...