## 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 frequency and...## The Swiss Army Knife of Digital Networks

This blog describes a general discrete-signal network that appears, in various forms, inside so many DSP applications.

Figure 1 shows how the network's structure has the distinct look of a digital filter—a comb filter followed by a 2nd-order recursive network. However, I do not call this useful network a filter because its capabilities extend far beyond simple filtering. Through a series of examples I've illustrated the fundamental strength of this Swiss Army Knife of digital networks...

## Digital PLL's -- Part 1

1. IntroductionFigure 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...

## Decimator Image Response

Note: this is an improved version of a post I made to the dsp forum a few weeks ago.

This article presents a way to compute and plot the image response of a decimator. I’m defining the image response as the unwanted spectrum of the impulse response after downsampling, relative to the desired passband response.

Consider a decimate-by-4 filter with fs= 4 Hz, to which we apply the signal spectrum shown in Figure 1. The desired signal is the CW component at 0.22 Hz,...

## 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...## Data Types for Control & DSP

There's a lot of information out there on what data types to use for digital signal processing, but there's also a lot of confusion, so the topic bears repeating.

I recently posted an entry on PID control. In that article I glossed over the data types used by showing "double" in all of my example code. Numerically, this should work for most control problems, but it can be an extravagant use of processor resources. There ought to be a better way to determine what precision you need...

## PID Without a PhD

I both consult and teach in the area of digital control. Through both of these efforts, I have found that while there certainly are control problems that require all the expertise I can bring to bear, there are a great number of control problems that can be solved with the most basic knowledge of simple controllers, without resort to any formal control theory at all.

This article will tell you how to implement a simple controller in software and how to tune it without getting into heavy...

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

Recently I've been thinking about the process of envelope detection. Tutorial information on this topic is readily available but that information is spread out over a number of DSP textbooks and many Internet web sites. The purpose of this blog is to summarize various digital envelope detection methods in one place.

Here I focus on envelope detection as it is applied to an amplitude-fluctuating sinusoidal signal where the positive-amplitude fluctuations (the sinusoid's envelope)...

## Harmonic Notch Filter

My basement is covered with power lines and florescent lights which makes collecting ECG and EEG data rather difficult due to the 60 cycle hum. I found the following notch filter to work very well at eliminating the background signal without effecting the highly amplified signals I was looking for.

The notch filter is based on the a transfer function with the form $$H(z)=\frac{1}{2}(1+A(z))$$ where A(z) is an all pass filter. The original paper [1] describes a method to...

## A Simple Complex Down-conversion Scheme

Recently I was experimenting with complex down-conversion schemes. That is, generating an analytic (complex) version, centered at zero Hz, of a real bandpass signal that was originally centered at ±fs/4 (one fourth the sample rate). I managed to obtain one such scheme that is computationally efficient, and it might be of some mild interest to you guys. The simple complex down-conversion scheme is shown in Figure 1(a).It works like this: say we have a real xR(n) input bandpass...

## Benford's law solved with DSP

I have a longtime interest in the mystery of 1/f noise. A few years ago I came across Benford’s law, another puzzle that seemed to have many of the same characteristics.

Suppose you collect a large group of seemingly random numbers, such as might appear in a newspaper or financial report. Benford’s law relates to the leading digit of each number, such as "4" in 4.268, "3" in 0.0312, and "9" in -932.34. Since there are nine possible leading digits...

## Digital PLL's -- Part 1

1. IntroductionFigure 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...

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

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

IntroductionAn "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'...## Bayes meets Fourier

Joseph Fourier never met Thomas Bayes—Fourier was born in 1768, seven years after Bayes died. But recently I have been exploring connections between the Bayes filter and the Fourier transform.

By "Bayes filter", I don't mean spam filtering using a Bayesian classifier, but rather recursive Bayesian estimation, which is used in robotics and other domains to estimate the state of a system that evolves over time, for example, the position of a moving robot. My interest in...

## Almost 50,000 Members!

I am very happy to announce that DSPRelated.com will reach the 50,000 registered members mark before the end of 2009. To celebrate this milestone, I will buy a BMW 5 to the 50,000th person to register (please make sure to confirm you email address to activate your registration). Please read the fine prints after the picture.

I am just having fun here and it's not even April's fool day. The 50,000th member won't get a BMW (I wish I could offer it!),...

## 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...

## Do you like the new Comments System?

I have just finished implementing a new comments system for the blogs. Do you like it?

Please share your thoughts with me by adding a comment.

I'll wait a few days and make sure it works properly and then I'll port it to the code snippets and papers section.

Thanks!

## Understanding Radio Frequency Distortion

OverviewThe 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.

IntroductionTransmitting 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...

## Why Time-Domain Zero Stuffing Produces Multiple Frequency-Domain Spectral Images

This blog explains why, in the process of time-domain interpolation (sample rate increase), zero stuffing a time sequence with zero-valued samples produces an increased-length time sequence whose spectrum contains replications of the original time sequence's spectrum.

Background

The traditional way to interpolate (sample rate increase) an x(n) time domain sequence is shown in Figure 1.

Figure 1

The '↑ L' operation in Figure 1 means to...

## Polyphase Filters and Filterbanks

ALONG CAME POLY

Polyphase filtering is a computationally efficient structure for applying resampling and filtering to a signal. Most digital filters can be applied in a polyphase format, and it is also possible to create efficient resampling filterbanks using the same theories.

This post will walk through a reference implementation of both the downsampling polyphase filter and a downsampling polyphase filterbank using scipy, numpy, matplotlib, and python. It should also highlight some of...

## Frequency Dependence in Free Space Propagation

Introduction

It seems to be fairly common knowledge, even among practicing professionals, that the efficiency of propagation of wireless signals is frequency dependent. Generally it is believed that lower frequencies are desirable since pathloss effects will be less than they would be at higher frequencies. As evidence of this, the Friis Transmission Equation[i] is often cited, the general form of which is usually written as:

Pr = Pt Gt Gr ( λ / 4πd )2 (1)

where the...

## Accurate Measurement of a Sinusoid's Peak Amplitude Based on FFT Data

There are two code snippets associated with this blog post:

and

Testing the Flat-Top Windowing Function

This blog discusses an accurate method of estimating time-domain sinewave peak amplitudes based on fast Fourier transform (FFT) data. Such an operation sounds simple, but the scalloping loss characteristic of FFTs complicates the process. We eliminate that complication by...

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

Recently I've been thinking about the process of envelope detection. Tutorial information on this topic is readily available but that information is spread out over a number of DSP textbooks and many Internet web sites. The purpose of this blog is to summarize various digital envelope detection methods in one place.

Here I focus on envelope detection as it is applied to an amplitude-fluctuating sinusoidal signal where the positive-amplitude fluctuations (the sinusoid's envelope)...

## A Differentiator With a Difference

Some time ago I was studying various digital differentiating networks, i.e., networks that approximate the process of taking the derivative of a discrete time-domain sequence. By "studying" I mean that I was experimenting with various differentiating filter coefficients, and I discovered a computationally-efficient digital differentiator. A differentiator that, for low fequency signals, has the power of George Foreman's right hand! Before I describe this differentiator, let's review a few...

## Linear-phase DC Removal Filter

This blog describes several DC removal networks that might be of interest to the dsprelated.com readers.

Back in August 2007 there was a thread on the comp.dsp newsgroup concerning the process of removing the DC (zero Hz) component from a time-domain sequence [1]. Discussed in that thread was the notion of removing a signal's DC bias by subtracting the signal's moving average from that signal, as shown in Figure 1(a).

Figure 1.

At first I thought...

## Computing the Group Delay of a Filter

I just learned a new method (new to me at least) for computing the group delay of digital filters. In the event this process turns out to be interesting to my readers, this blog describes the method. Let's start with a bit of algebra so that you'll know I'm not making all of this up.

Assume we have the N-sample h(n) impulse response of a digital filter, with n being our time-domain index, and that we represent the filter's discrete-time Fourier transform (DTFT), H(ω), in polar form...

## TCP/IP interface (Matlab/Octave)

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

PurposeMeasurement 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...

## Frequency-Domain Periodicity and the Discrete Fourier Transform

Introduction

Some of the better understood aspects of time-sampled systems are the limitations and requirements imposed by the Nyquist sampling theorem [1]. Somewhat less understood is the periodic nature of the spectra of sampled signals. This article provides some insights into sampling that not only explain the periodic nature of the sampled spectrum, but aliasing, bandlimited sampling, and the so-called "super-Nyquist" or IF sampling. The approaches taken here include both mathematical...

## Curse you, iPython Notebook!

First, I think ipython is great. I use it daily and always have an ipython terminal open. But just recently, I was showing off the ipython 0.12 notebook and in the process created a lengthy example while demonstrating the cool features of the ipython notebook. The example included LaTeX equations, plots, etc. Since the notebook session was on something of relevance I decided to clean up the session and use it for the beginning of a report.

## 50,000th Member Announced!

In my last post, I wrote that DSPRelated.com was about to reach the 50,000 members mark. Well, I am very happy to announce that it happened during the holidays, and the lucky person is Charlie Tsai from Taiwan. Charlie is an assistant professor in the Department of Electrical Engineering at the National Central University in Taiwan where he teaches the "Biomedical Signal Processing" class. He is also the advisor of the

## Almost 50,000 Members!

I am very happy to announce that DSPRelated.com will reach the 50,000 registered members mark before the end of 2009. To celebrate this milestone, I will buy a BMW 5 to the 50,000th person to register (please make sure to confirm you email address to activate your registration). Please read the fine prints after the picture.

I am just having fun here and it's not even April's fool day. The 50,000th member won't get a BMW (I wish I could offer it!),...

## DSPRelated faster than ever!

if you are visiting DSPRelated.com on a regular basis, you should observe that the site loads significantly faster in your browser than it used to, especially if you are in Europe or in Asia. The main reason for this is that I am now using Amazon's CloudFront service for the delivery of most static content on DSPRelated.com (images, javascripts, css). The cloudFront service automatically detects the location of a visitor and will deliver the static content from the server...

## New Papers / Theses Section

The new 'Papers & Theses' section is now online: http://www.dsprelated.com/documents.phpThe idea is to list and organize in one place as many DSP related dissertations (PhD & Masters) and papers/articles as possible.If you are the author of a thesis or paper and would like to have it listed on DSPRelated.com, please follow these steps:- Make sure that you are allowed to share the document online (copyright).- If you don't already have one, make a 'pdf' copy of your document. ...

## New Blog Section!

By now, chances are you have noticed the new blogs section (you are actually in it right now!).

Following an email I sent to the members of the site, a few weeks ago, asking for dsp engineers willing to blog here, I received around 50 propositions. I have selected an initial set of 10 bloggers (that I will soon introduce into a seperate post) and I am currently in the process of creating their accounts. Markus and Parth have already...

## New Discussion Group: DSP & FPGA

I have just created a new discussion group for engineers implementing DSP functions on FPGAs. The creation of this group has been on my todo list for a long time. If you want to join the group, send a blank email to: fpgadsp-subscribe@yahoogroups.com

As usual, it should take a few weeks before there are enough members for interesting discussions to get started.