## Sampling and the Mysterious Scaling Factor

This post treats the signals in continuous time which is different than the approach I adopted in my book. The book deals exclusively in discrete time.

Some time ago, I came across an interesting problem. In the explanation of sampling process, a representation of impulse sampling shown in Figure below is illustrated in almost every textbook on DSP and communications. The question is: how is it possible that during sampling, the frequency axis gets scaled by — a very large number? For an ADC operating at 10 MHz for example, the amplitude of the desired spectrum and spectral replicas is ! I thought that there must be something wrong somewhere.

*Figure 1: Sampling in time domain creates spectral replicas in frequency domain, each of which gets scaled by *

I asked a few DSP experts this question. They did not know the answer as well. Slowly I started to understand the reason why it is true, and in fact, makes perfect sense. The answer is quite straightforward but I did not realize it immediately. Since this is a blog post, I can take the liberty of explaining the route I took for this simple revelation.

## A Unit Impulse

My first impression was that whenever impulses are involved, everything that branches from there becomes fictitious as well. A continuous-time unit impulse is defined as shown in Figure 2.

Area under a rectangle = , or

*Figure 2: Definition of a unit impulse*

Clearly, the sampling scale factor is independent of how we define a unit impulse and its infinite height. The next step might be to look into a sequence of unit impulses: an impulse train.

## An Impulse Train

An impulse train is a sequence of impulses with period defined as

. The standard method to derive its Fourier Transform is through expressing the above periodic signal as a Fourier series and then finding Fourier series coefficients as follows.

First, remember that a signal with period can be expressed as

where and it can be seen as the fundamental harmonic in the sequence of frequencies with ranging from to . Here, are the Fourier series coefficients given as

When is an impulse train, one period between and only contains a single impulse . Thus, can be found to be

Plugging this in definition above and using the fact that and , we get

*Figure 3: Fourier Transform of an impulse train in time domain is another impulse train in frequency domain*

The resulting time and frequency domain sequences are drawn in Figure 3 above which is a standard figure in DSP literature. However, it really comes as a surprise that an impulse train has a Fourier Transform as another impulse train, although the Fourier Transform of a unit impulse is a constant.

**What happened to the concept that a signal narrow in time domain has a wide spectral representation?** Going through this method, it is not immediately clear why.

So I thought of deriving it through some other technique. Note that I prefer to use the frequency variable instead of .

From here, there are many techniques to prove the final expression, and the mathematics becomes quite cumbersome. So I just take the route of visualizing it and see where it leads.

## Where the Impulses Come From

First, the Fourier Transform of a time domain impulse train can be seen as the sum of frequency domain complex sinusoids with “frequencies” equal to , or periods equal to . Furthermore, the above signal is periodic with period of first harmonic .

Therefore, for the sake of better visualization, we limit ourselves to the range when drawing the figures in frequency domain. Whatever happens here gets repeated elsewhere. Figure 4 illustrates 3 frequency domain complex sinusoids for and , with frequencies and , respectively. Note how within a period of , the first completes one cycle, while the other two complete two and three cycles, respectively. Here, we deliberately refrained from drawing the result for which is a straight line at on axis.

*Figure 4: 3 frequency domain complex sinusoids for and , with frequencies and , respectively, in the range *

For a closer look, see the signal decomposed into and axes. Clearly, the axis consists of and the axis consists of again with and . This is shown in Figure 5.

*Figure 5: and decomposition of Figure 4. The axis consists of and the axis consists of again with and , in the range *

Having understood the basic concept, we now divide the range into segments each with width .

This implies that for integer ,

The result of summing the sinusoids shown in Figure 5 for a large is drawn in Figure 6.

*Figure 6: Summing the and parts from Figure 5 but for a very large in the range . The part is seen converging to 0 while the part approaches an impulse, half of which is visible at and half at *

**The rectangle at has a height of since it is a sum of for all values of .** It can now be concluded that

- arm — the expression — approaches at in each period . As , and it becomes an impulse (strictly speaking, the limit does not exist as a function and is rather known as a “distribution”).
- On the other hand, the arm — the expression — vanishes.

The scaling factor here can be found again by taking the area under the first rectangle. Thus,

Area under the rectangle ,

the same as found in Figure 3 (except the factor of ). Since it is a periodic signal, it consists of impulses repeating at integer multiples of — just what we saw in Figure 3 (except the factor as we are dealing in now). The complete sequence is now drawn in Figure 7.

*Figure 7: Displaying the branch from Figure 6 in the range for large *

It was then I realized my problem. **All the graphs and curves I have drawn, and DSP textbooks draw for that matter, use the wrong scaling on the axes!** Although the time and frequency domain impulse sequences look pretty much similar to each other, they are not. Imagine a very large number, say . Now if I draw the time and frequency domain representations of an impulse train within the range to , the signals would look like as illustrated in Figure 8 for a sample rate of MHz. As it is evident, all the confusion in the y-axis was due to incorrect scaling at the x-axis!

*Figure 8: For a MHz sample rate, there are (10 million) impulses in time domain for just 1 in frequency domain*

Here, it is easier to recognize that for an ADC operating at 10 MHz, there are (10 million) impulses on the time axis, for just one such impulse on the frequency axis. Let us express the equivalence of energy in time and frequency domains (known as Parseval’s relation) in a different way.

Clearly, the scaling of the frequency axis by seems perfectly logical. **A signal narrow in time domain is wide in frequency domain, finally!** I must say that this is the same figure as Figure 3 but until I went this route, I did not figure (pun intended) this out.

This reminded me of drawing the structure of an atom along with the solar system to indicate some similarity, without mentioning their respective scales, as in Figure 9.

*Figure 9: An atom and the solar system*

This also reinforced my concept of using the frequency variable instead of . While has its advantages at places, the variable connects us with what is out there: the reality. The commonly used ISM band is GHz, not G-radians/second.

## Going into Discrete Domain

Let us turn our thoughts in discrete domain now. There are two points to consider in this context.

- The main difference between a continuous-time impulse and a discrete-time impulse is that a discrete-time impulse actually has an amplitude of unity; there is no need to define the concept related to the area under the curve.
- There is a factor of that gets injected into expressions due to the way we define Fourier Transforms. This is the equivalent of the factor for continuous frequency domain in Discrete-Time Fourier Transform (DTFT).

A discrete impulse train is a sequence of unit impulses repeating with a period within our observation window (and owing to DFT input periodicity, outside the observation window as well). Figure 10 illustrates it in time domain for and .

*Figure 10: Discrete impulse train in time domain for and *

To compute its -point DFT ,

A few things to note in this derivation are as follows.

**I write DFT emphasizing on the expression**because it corresponds to the continuous-time frequency , explicitly exposing as the time variable similar to its counterpart (think of , or ).- From going to second equation from the first, I use the fact that except where .
- The third equation can be derived, again, in many ways such as the one described in the continuous-time case described before.

The final DFT output is shown in Figure 11 for and .

*Figure 11: Discrete impulse train in frequency domain for and *

Note how impulse train in time domain is an impulse train in frequency domain. So for and a discrete-time impulse train with a period of , the DFT is also an impulse train with a period of . Moreover, the unit impulses in frequency domain have an amplitude of as well. Observe that a shorter period in time domain results in a longer period in frequency domain. Also, the amplitude of those frequency domain impulses is times larger as well: compare with in Figure 3.

This is the same result as in continuous frequency domain with impulse train having a period of as well as a scaling factor of . However, it is much clearer to recognize in discrete domain due to the finite DFT size . That is why I talked about limiting the continuous frequency range within for a large and wrote Parseval’s relation as above.

## Sampling in Discrete Domain: Downsampling

With the above findings, we want to see what happens when a discrete-time signal is sampled with a discrete-time impulse train. In DSP terminology, this process is known as downsampling. Although it is common to discuss downsampling as a separate topic from sampling a continuous-time signal, both processes are intimately related and offer valuable insights into one another.

A signal can be downsampled by a factor of by retaining every th sample and discarding the remaining samples. Such a process can be imagined as multiplying with an impulse train of period and then throwing off the intermediate zero samples (in practice, no such multiplication occurs as zero valued samples are to be discarded). As a result, there is a convolution between and and spectral copies of arise: one at frequency bin and others at , all having a spectral amplitude of . As increases, the spectral replicas come closer and their amplitudes decrease proportionally. This is illustrated in Figure 12 for downsampling a signal by .

*Figure 12: Downsampling a signal by in time and frequency domains*

This is the same concept as sampling a continuous-time signal. Just as we decrease the amplitudes and spread of the resulting spectral copies by reducing the sampling rate, we decrease the amplitudes and spread of the resulting spectral copies by throwing off more samples, i.e., reducing the sampling rate. **In the former, this happens in proportion to ; in the latter, in proportion to .**

Put in this way, is choosing out of every samples. And is choosing out of every samples if there ever were. **In this context, is the probability density function (pdf) of a uniform random variable in the range .**

## An Alternative View

Carrying on, now we can look into an alternative view on sampling. First, consider the scaling property of the Fourier Transform.

Second, instead of impulse sampling, we can just see it as a scaling of the time axis. Taking the constant as ,

Here, is the counterpart of from impulse sampling with the difference being a real number instead of an integer . Also, instead of nano and micro seconds, has no units and we just deal it in the limiting case where the interval is divided into infinitesimally small segments and is just a positive number. In this way, this case becomes similar to downsampling where is always greater than .

The spectrum x-axis also gets scaled by leading to the fundamental relationship between continuous-time frequency and discrete-time frequency .

Within this framework, it is only after discarding the intermediate “samples” that the spectral replicas emerge. This is a result of defining the frequency axis in relation to periodic signals. There might be an alternative definition of frequency that would make processing the samples easier.

If you found this article useful, you might want to subscribe to my email list below to receive new articles.