# Sampling

## Continuous Time

Sampling a continuous-time signal means representing it as a sequence of points measured at regular intervals $$T$$. Notice that if we were to take a signal $$x(t)$$ and multiply it by an impulse train, then we would get a series of impulses equal to $$x(t)$$ at the sampling points and $$0$$ everywhere else. We can call this signal $$x\_p(t)$$.

$$p(t) = \sum\_{k=-\infty}^{\infty}{\delta(t-kT)}$$

$$x\_p(t) = x(t)p(t) = \sum\_{k=-\infty}^{\infty}{x(t)\delta(t-kT)}$$

In the Fourier Domain,

$$\begin{aligned} X\_p(\omega) &= \frac{1}{2\pi}X(\omega)\*P(\omega)\ P(\omega) &= \frac{2\pi}{T}\sum\_{k=-\infty}^{\infty}{\delta(\omega-k\omega\_0)}\ \therefore X\_p(\omega) &= \frac{1}{2\pi}\int\_{-\infty}^{\infty}{X(\theta)P(\omega-\theta)d\theta} = \frac{1}{T}\sum\_{k=-\infty}^{\infty}{X(\omega-k\omega\_0)}\end{aligned}$$

What this tells us is that the Fourier Transform of our sampled signal is a series of copies of $$X(\omega)$$, each centered at $$k\omega\_0$$ where $$\omega\_0 = \frac{2\pi}{T}$$ For example, lets say that our original signal has the following Fourier Transform. Notice the signal is band-limited by $$\omega\_M$$.

![](https://3896527066-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQYqMkpf2WPiP6MKWRe%2Fuploads%2Fgit-blob-c7dc08f0442a4d5456cc2c9d40ac8321761f06f2%2Ff720e3cc7c9c146540093fe305252892ebf80c9f.png?alt=media)

There are two major cases: if $$\omega\_0 > 2\omega\_m$$ and $$\omega\_0 < 2\omega\_M$$. **Case One:** $$\omega\_s > 2\omega\_m$$

![](https://3896527066-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQYqMkpf2WPiP6MKWRe%2Fuploads%2Fgit-blob-5199f4d6205c5ce767a8edac5d653cfde0e80661%2F72a019c68af425b148cbc21e7a3709ced6a5572e.png?alt=media)

When $$\omega\_s > 2\omega\_M$$, the shifted copies of the original $$X(\omega)$$ (shown in blue) do not overlap with each other or which the original copy. If we wanted to recover the original signal, we could simply apply a low pass filter to isolate the unshifted copy of $$X(\omega)$$ and then take the inverse Fourier Transform. **Case Two:** $$\omega\_s < 2\omega\_m$$

![](https://3896527066-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQYqMkpf2WPiP6MKWRe%2Fuploads%2Fgit-blob-618f5b7eb69bab45e59c6e7d03d53d4b95262494%2F83046672178ba3bb6c8d2d9e6885d19a71ccad6d.png?alt=media)

Notice how in this case, the shifted copies overlap with the original $$X(\omega)$$. This means in our sampled signal, the higher frequency information is bleeding in with the lower frequency information. This phenomenon is known as aliasing. When aliasing occurs, we cannot simply apply a low pass filter to isolate the unshifted copy of $$X(\omega)$$.

When $$\omega\_0 = 2\omega\_M$$, then our ability to reconstruct the original signal depends on the shape of its Fourier Transform. As long as $$X\_p(k\omega\_m)$$ are equal to $$X(\omega\_m)$$ and $$X(-\omega\_m$$), then we can apply an LPF because we can isolate the original $$X(\omega)$$ and take its inverse Fourier Transform.

Remember that an ideal low pass filter is a square wave in the frequency domain and a sinc in the time domain. Thus if we allow

$$X\_r(\omega) = X\_p(\omega)\cdot \begin{cases} T & \text{if } |\omega| < \frac{\omega\_s}{2}\ 0 & \text{else } \end{cases}$$

then our reconstructed signal will be

$$x\_r(t) = x\_p(t)\*\text{sinc}\left(\frac{t}{T}\right) = \sum\_{n=-\infty}^{\infty}{X(nT)\text{sinc}\left(\frac{t-nT}{T}\right)}.$$

This is why we call reconstructing a signal from its samples "sinc interpolation." This leads us to formulate the Nyquist Theorem.

{% hint style="info" %}

### Theorem 18 (CT Nyquist Theorem) <a href="#theorem-18" id="theorem-18"></a>

Suppose a continuous signal $$x$$ is bandlimited and we sample it at a rate of $$\omega\_s > 2\omega\_M$$, then the signal $$x\_r(t)$$ reconstructed by sinc interpolation is exactly $$x(t)$$
{% endhint %}

## Discrete Time

Sampling in discrete time is very much the same as sampling in continuous time. Using a sampling period of $$N$$ we construct a new signal by taking an impulse train and multiplying elementwise with the original signal.

$$\begin{aligned} p\[n]=\sum\_{n=-\infty}^{\infty}{\delta\[n-kN]}\ x\_p\[n] = x\[n]p\[n] = \sum\_{n=-\infty}^{\infty}{x\[kN]\delta\[n-kN]}\ X\_p(\omega) = \frac{1}{N}\sum\_{k=0}^{N-1}{X(\omega-k\omega\_s)}\end{aligned}$$

Our indices only go from $$k$$ to $$N-1$$ in the Fourier Domain because we can only shift a particular number of times before we start to get repeated copies. This is the impulse train sampled signal. It has 0’s at the unsampled locations. If we want to, we could simply remove those zeros and get a downsampled signal

$$x\_p\[n] = x\[Nn]$$

Like in continuous time, the reconstructed signal is recovered via sinc interpolation.

$$x\_r\[n] = \sum\_{k=-\infty}^{\infty}{x\_p\[n]\text{sinc}\left(\frac{n-kN}{N}\right)}$$

The Nyquist Theorem in DT will tell us when this works.

{% hint style="info" %}

### Theorem 19 (DT Nyquist Theorem) <a href="#theorem-19" id="theorem-19"></a>

Suppose a discrete signal $$x$$ is bandlimited by $$\frac{\pi}{N}$$ and we sample it at a rate of $$\omega\_s > 2\omega\_M$$, then the signal $$x\_r\[n]$$ reconstructed by sinc interpolation is exactly $$x\[n]$$
{% endhint %}

Thus as long as the Nyquist Theorem holds, we can take a downsampled signal and upsample it (i.e reconstruct the missing pieces) by expanding $$y$$ by a factor of $$N$$ and putting $$0's$$ for padding, and then applying sinc-interpolation to it.

## Sampling as a System

Notice that we have two ways of representing our sample signal. We can either write it as a discrete time signal $$x\_d\[n] = x(nT)$$ or we can write it as an impulse train $$x\_p(t)=\sum\_{-\infty}^{\infty}{x(nT)\delta(t-nT)}$$. Based on their Fourier Transforms,

$$\begin{aligned} X\_d(\Omega)=\sum\_{n=-\infty}^{\infty}{x(nT)e^{-j\Omega n}}\ X\_p(\omega)=\sum\_{n=-\infty}^{\infty}{x(nT)e^{-j\omega nT}}\end{aligned}$$

Thus if we let $$\Omega=\omega T$$, then we see that these two representations of a signal have the same Fourier Transforms and thus contain the same information. This means that for some continuous signals, convert them to discrete time via sampling, use a computer to apply an LTI system, and convert the result back to a CT output.

![](https://3896527066-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MQYqMkpf2WPiP6MKWRe%2Fuploads%2Fgit-blob-c693e3d063eceaa3a808118aa324fe8d67170970%2Fa267ecab04b07fb243cea316fca7f47e24264ab4.png?alt=media)

We must be careful though because as long as the DT system we apply is LTI, the overall CT system will be linear too, but it will not necessarily be time invariant because sampling inherently depends on the signal’s timing.

$$\begin{aligned} Y\_d(\Omega) &= H\_d(\Omega)X\_d(\Omega) = H\_d(\Omega)X\_p\left(\frac{\Omega}{T}\right)\ Y\_p(\omega) &= Y\_d(\omega T) = H\_d(\omega T)X\_p(\omega)\ Y(\omega) &= \left{ \begin{array}{cc} T & |\omega| < \frac{\omega\_s}{2}\ 0 & |\omega| \ge \frac{\omega\_s}{2} \end{array} \right} \cdot Y\_p(\omega) = \left{ \begin{array}{cc} TH\_d(\omega T)X\_p(\omega) & |\omega| < \frac{\omega\_s}{2}\ 0 & |\omega| \ge \frac{\omega\_s}{2} \end{array} \right}\end{aligned}$$

Assuming that the Nyquist theorem holds,

$$\begin{aligned} X\_p(\omega) &= \frac{1}{T}X(\omega)\ \therefore Y(\omega) &= \left{ \begin{array}{cc} H\_d(\omega T)X(\omega) & |\omega| < \frac{\omega\_s}{2}\ 0 & |\omega| \ge \frac{\omega\_s}{2} \end{array} \right}\ \therefore H\_{system} &= \left{\begin{array}{cc} H\_d(\omega T) & |\omega| < \frac{\omega\_s}{2}\ 0 & |\omega| \ge \frac{\omega\_s}{2} \end{array} \right}\end{aligned}$$

This shows us that as long as the Nyquist theorem holds, we can process continuous signals with a disrete time LTI system and still have the result be LTI.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://aparande.gitbook.io/berkeley-notes/ee120-0/ee120-7.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
