# Multi-Rate Processing and Sample Rate Conversion: A Tutorial

Multi-rate processing and sample rate conversion, or interpolation and decimation as they re known, are a clever digital signal processing (DSP) techniques that broadband and wireless design engineers can employ during the system design process. Using these techniques, design engineers can gain an added degree of freedom that could improve the overall performance of a system architecture.

Multi-rate processing finds use in signal processing systems where various sub-systems with differing sample or clock rates need to be interfaced together. At other times multi-rate processing is used to reduce computational overhead of a system. For example, an algorithm requires k operations to be completed per cycle. By reducing the sample rate of a signal or system by a factor of M, the arithmetic bandwidth requirements are reduced from kf_{s} operations to kf_{s}/M operations per second.

Sample rate conversion, on the other hand, is employed when resampling a signal at a lower rate in order to allow it to pass through a channel with limited bandwidth. Additionally, this technique can be employed to develop highly accurate Delta-Sigma analog-to-digital converters (ADCs) with a high modulation rate at the front end followed by a decimator to reduce sampling rate, thus providing converted samples at or near the Nyquist rate.

The above applications provide a glimpse of just a few of the communication applications where using multi-rate processing and sample-rate conversion makes sense. But to implement these techniques, designers must first better understand how they work. Here's a tutorial to help out.

**Types of Sample-Rate Conversion**

There are three types of sampling rate conversion. These include downconversion or decimation by a factor M; upconversion by a factor L; and sampling rate conversion by a ratio of M and L

To start the discussion, let's focus on downconversion. From past work, it has been determined that it is easier to understand what is going on in sampling rate conversion by starting with what the spectrum of a sampled signal looks like.

The spectrum of a sampled signal can be written:

X_{s}(jΩ) = (1/T)Σ X_{c}(jΩ - jkΩ_{s}s)

where the summation is over k from - to while T = time period of the sampling frequency &Omerga;_{s}

The result of this sampled signal are shown in **Figure 1**

*Click here for Figure 1*

*Figure 1: Effect of periodic sampling.*

As Figure 1 shows, the sampling process simply generates replicas of the original signal everywhere along the frequency axis. The separation between the replicas (also known as aliases) is the same as the sampling frequency.

From Figure 1 it is fairly easy to see that if the sampling frequency is not large enough, replicas will start overlapping. As the sampling frequency increases the replicas start moving away from each other. At the points of overlap the information will be corrupted. This must be avoided in sampling.

The rule is, keep the sampling frequency at least 2X the maximum bandwidth of the signal you want to sample (or limit the bandwidth by pre-filtering). In practice, of course, this sampling frequency may be 4X or 8X or even higher. In fact, in Delta-Sigma or over-sampled systems it may be as high as 256X ( which confers some benefits on the design sometimes).

**Making it Practical**

The question is, what does all this mean in practical terms? In order to get an intuitive understanding of decimation lets assume that a data signal is being transmitted down a cable. This data is generated by sampling an analog signal, and following the sampler with an A/D converter and a buffer as shown in **Figure 2**.

*Click here for Figure 2*

*Figure 2:Block diagram of a digital transmission system.*

Note, that the sampler is simply a switch controlled by the sampling clock. A pre-filter has been inserted between the input and the sampler to limit the bandwidth of the input and to get rid of accompanying noise which can cause problems with the sampled signal.

The digital signal (numbers) is then transmitted down the physical link. The buffer simply overcomes the attenuation of the physical media. Note that in the simplest case the digital signal is being sent at the sampling rate. If the receiver can operate at the same sampling rate (or higher), then all that has to be done is to read the received digital signal into the receiver and extract the original signal simply by low pass filtering the signal.

However, if the receiver operates at a much slower rate, say 3X slower, then it can only read one out of 3 samples of the signal. Can this signal still be received properly?

One way to solve this problem is to first use a digital-to-analog converter (DAC), convert to an analog signal, and then re-sample the reconstructed analog signal at a slower rate (3X slower). This means we need more power, more circuitry, less reliability etc.

Another way is to simply use digital re-sampling, in this case using decimation. Here's an example to illustrate the impact of re-sampling.

In this example, let's fundamentally assume a 3X decimation. In other words only one out of 3 samples are chosen and the rest are discarded. Therefore there are actually two signals that have to be considered. One is the old signal running at the old sampling rate, and the other is the new signal running at the new sampling rate. Let these variables be: x(n), x_{d}(n), T and T_{old}. Therefore, let:

3T_{old} = T

where the factor 3 is the decimation factor, typically labeled "M".

We know from the description of the sampling process given above, what old signal looks like in the frequency domain. The question is what does the new signal look like in the same domain. (Note: It is actually easier to work in the frequency domain than the time domain in this case). To see this we have to go through some mathematical manipulations first and then describe the effects pictorially and see what must be done to decimate at 3X.

Starting from the frequency domain expression for the sampled signal that is repeated here for convenience.

X_{s}(jΩ) = (1/T)Σ X_{c}(jΩ - jkΩ_{s})

where the summation is over k from -∞ to ∞ and T = time period of the sampling frequency Ω_{s}

When we change the continuous frequency variable to the discrete frequency variable we get:

X(e^{jω}) = Spectrum of x(n) = 1/TΣ X_{c}(jω/T_{old} -- jk2π/T_{old})

where the summation is over k from -∞ to ∞ and T = time period of the sampling frequency Ω_{s}

Now a down sampler will have a sampling frequency of 1/MT_{old}. In our case M=3. So our down sampler has a frequency of:

1/3T_{old}, T_{old} = old sampling frequency
So now we re-sample the input with this new sampling frequency. The new spectrum is then:

1/3T_{old}Σ X_{c}(jω/3T_{old} - jr2π/3T_{old})

where the summation is over r from -∞ to ∞ and T = time period of the sampling frequency Ω_{s}

Notice that the summation variable has changed from k to r. r is the new summation variable and is closely related to k via the following transformation.

r = i + kM

Using these three expressions the frequency domain behavior of decimation can be explored.

First, the frequency spacing between replications of the decimated signal is one third of the old signal from the equation of the frequency spectra of the decimated signal. Pictorially the situation is depicted in **Figure 3**.

*Click here for Figure 3*

*Figure 3: Effect of decimation by 3.*

As can be seen from Figure 3, the sampling rate can be decreased and again a low pass filter can be used to extract the information. The effect is the introduction of spectra in between the replications of the old spectra.

The relationship above defines how many spectra are introduced. The counter i goes from 0 to 2 ( M=3). Since M = 3 we have the spectra number r being defined by k and M.

Referring to Figure 3, let k =0 and then let r = i. The decimation factor for the example above is M=3. Then the number of spectra that fit in one old sampling frequency space ( 2π/T_{old} space) can be seen to be 3. Specifically, k=0, r=0,1,2. The k=1, r=3,4,5, then k=2 and r=6,7,8 and so on. i determines the number of spectra between each old spectra spacing.

We must be aware that the rules for Nyquist rate sampling still apply. There is a limit to the decimation factor. We can only decimate until aliasing starts. So knowing the old spacing and the bandwidth of the signal, we can choose a decimation factor M which will allow us to reduce the sampling rate and yet avoid aliasing and corruption of the re-sampled signal. Or alternatively we can limit the bandwidth of the signal before we resample to achieve the same effect. Therefore the generic system diagram of a down sampler is that shown in **Figure 4**.

*Click here for Figure 4*

*Figure 4: Generic diagram of a down sampler.*

Note that some practical considerations have been left out in this description of decimation. However, the idea here is to present the techniques in a semi-intuitive fashion so that the main idea can be grasped easily and "gut feel" can be developed. Once this happens the more practical aspects/concerns of the technique can be not only understood, but also taken care of as they arise.

**Understanding Upconversion**

Let's now consider sampling rate upconversion (also called interpolation). In interpolation the sampling rate is actually increased. This is a slightly more intricate operation than decimation since we need more samples than that originally available. The process is illustrated in the following diagrams with accompanying descriptions so that it can be understood intuitively.

In these diagrams and descriptions the sampling rate increase will be by a factor of 4. The upsampling factor is L and in this example L=4. Again a frequency domain description is well suited to understanding the operation of up sampling.

**Figure 5** provides a graphical representation of interpolation.

*Click here for Figure 5*

*Figure 5: Example of interpolation where the unsampling factor (L) equals 4.*

In Figure 5, the process of interpolation is carried out as follows:

- Insert the requisite number of zero's between each two samples of the old sampled signal. ( 3 new zero valued samples for L = 4).
- Establish the new index for the interpolated sequence. This is described below.
- Filter out the old spectrum by using a filter centered at 0 Hz and Ω
_{s}(new). This is called the interpolation filter. The output of the filter is the desired up sampled digital signal or sequence.

The output of the interpolation filter will contain residuals of the old spectrum as shown in Figure 5, since the filter cannot be ideal. Thus the performance of the interpolation depends critically on the interpolation filter.

The mathematics of interpolation is analogous to that of decimation. The old signal is given by:

x_{old}(n) where n is the sample index

The up sampled signal is given by

x_{new}(n) = x_{old}(n/L) if n = +/-0, +/-L, +/-2L etc = 0 otherwise.

In the frequency domain, the results for the upsampled signal ( from the Fourier response) are represented by:

X_{new}(e^{jω}) = Σ x_{old}(n)e^{-jnLω}

Summation over n

This shows that the old spectrum is simply scaled in frequency as shown in figure 5.

There are many applications for interpolation. In general any interfacing of digital signals from a lower frequency source to a higher frequency sink can and should use interpolation in the digital domain. This can save power and silicon space thereby rendering the product more efficient and cost effective.

**Sampling rate conversion**

The third, and final component, is sampling rate conversion by ratios L and M. This conversion solves the problem of changing sampling rates by a factor that is not an integer. Since we are free to choose L and M, we can change sample rates by almost any factor in practice. Simply choose L and M appropriately. This technique is shown in **Figure 6**.

*Click here for Figure 6*

*Figure 6: Fractional re-sampling (L/M) interpolate and then decimate.*

Note that it is entirely possible to combine the two filters together and thus have a single filter between the interpolator and the decimator. The combination interpolator and decimator is also called a sample rate converter. In other words L < d="" gives="" us="" an="" interpolator="" and="" when="" d="">L we have a decimator. The purpose of the filter has been explained above.

**Wrap Up**

A concise description of sampling rate conversion and multi-rate sampling has been presented. Although at times it appears counter intuitive, the technique is an exceptionally useful one. Once understood it can lead to powerful new architectures in both analog/mixed signal and digital signal processing. In terms of IC design, the use of these techniques leads to robust designs with flexible, programmable and re-configurable frequency domain interfaces. Using these techniques, reduction in power dissipation and silicon area are readily obtainable.

**About the Author**

**Mohammed Rehman** is the founder and chief scientist at Signal Processing Group. He holds an MSEE a master's degree in electronics from the university of Birmingham in the UK. Mohammed can be reached at spg001@mcleodusa.net.

post a commentregarding this story.