CS代考 Sampling and reconstruction

Sampling and reconstruction
Most physical signals (and systems) are best modeled as being continuous-time signals (and systems). Signals (and systems) stored (and implemented) in computers are best modeled as being discrete-time signals (and systems). A natural way to convert continuous-time physical signals into discrete-time signals is via sampling.
One we have sampled a continuous-time signal, we typically then carry out processing on the resulting discrete-time signal. Often we then need to convert the resulting signal back to continuous-time so it can be used to a↵ect a physical system. The process of taking a discrete- time signal and converting it to a continuous-time signal is often called reconstruction.
This topic is about understanding what information we lose (if any) when we sample a signal, and how to reconstruct a continuous-time signal from its samples.

Copyright By PowCoder代写 加微信 powcoder

9.1 Sampling
We begin by recalling some basic terminology about sampling from Topic 1. If x is a continuous- time signal and Ts is a sampling period we can define a discrete-time signal
xs[n] = x(nTs) for all n (9.1)
by sampling x every Ts seconds. If Ts is the sampling period then the sampling frequency is !s = 2⇡/Ts rad/second (or fs = 1/Ts Hz). Clearly the higher the sampling frequency is, the better xs approximates x.
9.1.1 Sampling and aliasing with sinusoids
Suppose x(t) = cos(!0t) is a sinusoid and we sample x with sampling period Ts. The resulting DT signal is
xs[n] = x(nTs) = cos(!0Tsn).
It turns out there are (infinitely many) other CT signals that, if we sample them with sampling
period Ts, give us exactly xs. Indeed, for any integer ` let x`(t) = cos✓!0 + 2⇡`◆t.
Ts If we sample x` with sampling period Ts we obtain
x`,s[n] = x`(nTs) = cos(!0Tsn + 2⇡`n) = cos(!0Tsn) = xs[n].
So there are many di↵erent (sinusoidal) signals that are indistinguishable once we sample with sampling period Ts.

Example 9.1
The following plot shows cos(⇡t) and cos(9⇡t) and the resulting samples obtained if we sample both with sampling period Ts = 0.25 seconds.
The two CT signals, when sampled with sampling period T = 0.25 seconds, appear iden- tical.
Many di↵erent CT signals appear the same once we sample them. This phenomenon is called aliasing.
One of the basic reasons this happens is that there is a maximum frequency in DT whereas there is no maximum frequency in CT. This means that high enough CT frequency components must end up being aliased to low frequency components in DT.
9.1.2 Frequency-domain model of sampling
We have seen that a CT signal x and its sampled version xs (sampling with sampling period Ts) are related by a simple formula (9.1) in time domain. What is the relationship between the CT Fourier transform X of the CT signal X and the DT Fourier transform Xs of the DT signal xs?
Relating CTFT of a signal and DTFT of its sampled version
Suppose x is a CT signal and xs is the DT signal obtained by sampling x with sampling period Ts = 2⇡/!s, i.e.,
xs[n] = x(nTs) for all n. Then the DTFT Xs of xs and the CTFT X of x are related by
Xs(!)= 1 X1 X✓!2⇡`◆ (9.2) Ts `=1 Ts
To understand where this (complicated-looking) formula comes from, it is easiest to first consider the case when the sampling period is Ts = 1, before considering the general case.

The case Ts = 1
First, let’s think about what happens when the sampling period is one. Then one sample takes one second, so units of time are at least the same length in CT and DT. In that case, the main discrepency between the CTFT X and the DTFT Xs is that the CTFT is aperiodic and the DTFT must be periodic. In Topic 5 we made a finite duration signal periodic by the shift-and- add summation. The same idea allows us to form a periodic signal out of any aperiodic signal. In this case we might guess that
Xs(!) = X1 X(! 2⇡`) `=1
which is periodic with period 2⇡. Notice that this is exactly the formula (9.2) in the special case Ts = 1.
To see more formally why this is true, we need to check that the inverse DTFT of Xs is, indeed xs. We have that
1 X1 Z Z 2 ⇡ j ! n
d! = 2⇡ X(! 2⇡`)e d!
1 1 2⇡`+2⇡ 0 j(!0+2⇡`)n 0
= 2⇡ X(! )e d!
1 1 2⇡`+2⇡ 0 j!0n 0
= 2⇡ X(! )e d!
= 1 1 X(!0)ej!0n d!0
2⇡ 1 = x(n)
Here the second equality holds by making the change of variables !0 = ! 2⇡` in each integral (separately). The third equality holds because ej(!0+2⇡`)n = ej!0n for all `. The fourth equality holds because the integral from 1 to 1 is the same as chopping up the integral into a sum over each of the intervals 2⇡` to 2⇡` + 2⇡. The second-last equality is just the definition of the inverse CTFT. The last equality holds because the sampling period is one so xs[n] = x(n).
General sampling period
One way to understand the general sampling period case is to think about sampling with period Ts as a composition of time-scaling and then sampling with period 1. If x is a CT signal, let
y(t) = x(tTs) be a signal obtained by time-scaling x. Then
xs[n] = x(nTs) = y(n) for all n,
so sampling y with sampling period 1 is the same as sampling x with sampling period Ts. If Y
is the CTFT of y then we know (from the discussion above) that
Xs(!) = X1 Y (! 2⇡`). (9.3)

AllwearelefttodoisrelatetheCTFTY ofyandtheCTFTXofx. Thisisdoneviathe time-scaling property of the CT Fourier transform. This tells us that
Y (!) = T1 X ✓ T! ◆ . (9.4) ss
Combining (9.4) and (9.3) gives us (9.2).
This scaling is very intuitive when we think about units. The input of X should be continuous
frequency in radians/second. The input of Xs should be discrete-frequency in radians/sample. The sampling period Ts has units seconds/sample. So if ! (the input to Xs) is in radians/sample it follows that !/Ts is in radians/second, which is the right frequency to use as the input to X.
9.1.3 Bandwidth and aliasing
We now consider how to interpret the formula (9.2) relating the CTFT of a signal to the DTFT of its sampled version. There are two cases to consider, depending on which frequency components appear in the CT signal of interest.
Note that there are many definions of bandwidth of a signal. This definition, which we will use throughout this topic, is often (more precisely) called the baseband bandwidth.
Let x be a CT signal with bandwidth W . A possible Fourier transform for x is shown below: X(!)
If xs is obtained by samplng x with sampling period Ts then there are two possibilities for how
Xs, the DTFT of xs will look.
W Ts < ⇡ gives non-overlapping copies If W Ts < ⇡ then the DTFT Xs of the sampled signal is shown below: We say a CT signal x (with Fourier transform X) has bandwidth W if X(!) = 0 whenever |!| > W.

Notice that it is obtained by taking X, scaling the horizontal and vertical axes by a factor of Ts and then adding up copies shifted by multiples of 2⇡. In this case the copies do not overlap. This means that all of the information in x is ‘preserved’ in the sampled version xs.
W Ts > ⇡ gives overlapping copies
If WTs > ⇡ then we can find the DTFT Xs of the sampled signal by taking copies of 1 X(!/Ts)
3⇡ 2⇡ ⇡WTs 0 WTs⇡ 2⇡ 3⇡
shifted by multiples of 2⇡
3⇡ 2⇡ WTs ⇡ and summing them up, to obtain
3⇡ 2⇡ WTs ⇡
0 ⇡WTs 2⇡ 3⇡
0 ⇡WTs 2⇡ 3⇡
In this case the copies overlap and so when we sum the up, the high frequency information (above frequency ⇡/Ts) in x is aliased onto the low frequencies of xs causing aliasing distortion. We can avoid introducing this aliasing distortion by using an anti-aliasing filter. We discuss this in the next section.
If we sample a CT signal with sampling period Ts, there is a significant di↵erence between what happens to signals with bandwidth above and below ⇡/Ts. If the signal bandwidth is below this critical frequency, no aliasing occurs. Otherwise aliasing occurs.
Nyquist frequency
If we are sampling a CT signal with sampling period Ts the frequency ⇡ radians/second Ts

is called the Nyquist frequency.
Summary of Section 9.1
Sampling converts CT signals into DT signals. It is useful to model and interpret the sampling process in the frequency domain. When we sampling a unit complex exponential with sampling frequency !s, any frequencies higher than !s/2 are ‘aliased’, and appear as lower frequencies in the sampled signal.
The highest frequency component appearing in a signal defines its bandwidth. If the bandwidth is low compared to the sampling frequency, no aliasing will occur. If the bandwidth is too high compared to the sampling frequency, aliasing will occur.
9.2 Anti-aliasing filters
The information content in a signal is often bandlimited. For example, audible sounds usually contain essentially no frequency components above about 4kHz. Nevertheless, practical signals are never bandlimited. They contain high frequency components that consist of noise or other disturbances that we do not want to keep when we sample the signal.
If we sample such a signal, the (unwanted) high frequencies will be aliased and interfere with the low frequencies that carry the information in which we are interested. So what should we do?
One way to avoid this is to pass a signal through a low-pass filter before sampling. Such a filter is called an anti-aliasing filter. If we are going to sample a CT signal with sampling period Ts = 2⇡/!s then an ideal anti-aliasing filter is an ideal low-pass filter with cuto↵ frequency !c = !s/2 = ⇡/Ts. Consider the signal x with CT Fourier transform
Suppose we choose a sampling period Ts such that WTs > ⇡ so that aliasing will occur if we sample x directly. Instead, we first pass X through an ideal anti-aliasing filter (with cut-o↵ frequency ⇡/Ts rad/second) to obtain a signal y with CT Fourier transform
W⇡ 0 ⇡W Ts Ts
This is now bandliminted with bandwidth ⇡/Ts. If we now sample y with sampling period Ts, the resulting DT signal ys has DTFT given by
W⇡ 0 ⇡W Ts Ts

Notice that no aliasing has occured! The only ‘loss’ is that we removed frequency components above the Nyquist frequency. Otherwise, the sampled signal has all of the frequency content of the original CT signal x up to the Nyquist frequency. This is in contrast with the situation where no anti-aliasing filter is used. In that case the DTFT of the sampled signal was
3⇡ 2⇡ ⇡ 0 ⇡ 2⇡ 3⇡
0 ⇡WTs 2⇡ 3⇡
3⇡ 2⇡ WTs ⇡
In that case the frequency information above 2⇡/Ts W rad/second was distorted due to
9.2.1 Using anti-aliasing filters
In practice we should always use an anti-aliasing filter before sampling. If we have the luxury to choose the sampling rate of our system, we should design it based on the bandwidth of the information of interest in the signal we are sampling, rather than the bandwidth of the signal itself. To avoid aliasing, we typically do the following.
• Choose a sampling rate Ts so that the sampling frequency ⇡/Ts is a little more than W, the bandwidth of the part of the signal containing the information of interest (not the bandwidth of the signal itself)
• Design a low-pass anti-aliasing filter that (approximately) passes frequencies |!| < W and (approximately) stops frequencies |!| > ⇡/Ts. Because we chose the sampling frequency so that ⇡/Ts is a little larger than W, this is possible with a practical filter.
Summary of Section 9.2
The useful information in a signal is often contained in its low frequencies. The high frequency components often contain noise. If we are going to sample a signal, we do not want the (unwanted) high frequencies to interfere with the (desired) low frequencies due to aliasing. This is why we should use an anti-aliasing filter before sampling. This is a low-pass filter that rejects frequencies higher than !s/2.

9.3 Reconstruction
In this section we discuss methods to reconstruct a CT signal from a DT signal. We consider ‘ideal’ reconstruction, as well as more practical methods like the zero-order hold. The basic phi- losophy behind ‘ideal’ reconstruction is to reconstruct by choosing the CT signal with smallest bandwidth that agrees with the DT signal at each of the sample instants.
For example, consider the DT sinusoid x[n] = cos(⇡n/4) for all n. In this case, the ‘ideal’ reconstruction would be
In practice other reconstruction methods are used, such as the zero-order hold (or piecewise constant interpolation)
or the first-order hold (or piecewise linear interpolation)

9.3.1 Linear models of reconstruction: time domain viewpoint
Next we describe how to model reconstruction methods using linear systems ideas. We begin with the time-domain viewpoint, which is easiest to understand via the example of zero-order hold (piecewise constant) reconstruction.
If xs is a DT signal, such as the one shown below
2 1 0 1 2 3 1
then the zero-order-hold reconstruction of xs looks like y(t)
Let hZOH(t) = u(t) u(t Ts) be a CT ‘pulse’ with duration Ts.
Ts 0 Ts Then the zero-order-hold reconstruction of xs can be written as
y(t) = X1 xs[n]hZOH(t nTs). n=1
This looks a lot like a convolution sum, except one of the signals involved is a DT signal and one is a CT signal. One mathematically convenient way to model this as a convolution is to
Ts 2Ts 3Ts

think of the DT signal as the impulse train w(t) = X1 xs[n](t nTs)
= · · · + xs[2](t + 2Ts) + xs[1](t + Ts) + xs[0](t) + xs[1](t Ts) + · · · .
Then we can think of the zero-order hold reconstruction y as the convolution of the impulse
train w with the pulse of width Ts, i.e.,
y = hZOH ⇤ w.
In other words, we can model a zero-order hold as taking a DT signal, converting it into an impulse train, and then passing it through an LTI system with impulse response hZOH. By replacing hZOH with another impulse response h, we can use this model to obtain other reconstruction methods.
LTI model of reconstruction
If we use a general reconstruction filer with impulse response h, then the basic LTI model of reconstruction is shown below:
impulse generator
One desirable feature of a reconstruction method is that the output signal y interpolates the DT signal xs, i.e.,
y(nTs) = xs[n] for all n
The zero-order hold reconstruction method has this property. The following describes the prop- erty that the impulse response of a reconstruction filter needs to have so that the reconstructed signal interpolates the DT signal.
Reconstruction filters that interpolate the DT signal
If the impulse response of the reconstruction filter satisfies:
h(nTs)=[n]=(1 ifn=0 0 ifn6=0.

then the reconstructed CT signal y will agree with xs at the sample instants, i.e., y(nTs) = xs[n] for all n.
This is becuase X1
y(t) = xs[k]h(t kTs)
k=1 and so if h(nTs) = [n] for all n then
y(nTs) = X1 xs[k]h((n k)Ts) = X1 xs[k][n k] = xs[n] k=1 k=1
for all n.
Example 9.2: First-order hold: convolution with impulse train
We can model the first-order hold (linear interpolation) reconstruction method using the reconstruction filter with impulse response
8><>:1+t/Ts ifTs t0 hFOH(t)= 1t/Ts if0tTs
0 otherwise.
hFOH (t) 1
Notice that hFOH(0) = 1 and hFOH(nTs) = 0 for non-zero integers n. This means that if we use this reconstruction filter in the architecture shown above, we obtain a reconstruction that satisfies y(nTs) = xs[n] for all integers n.
impulse generator
9.3.2 Linear models of reconstruction: Frequency domain viewpoint
Now we have an LTI system viewpoint of reconstruction, we can try to analyse it in the frequency domain. In particular, we would like to know which signals we can perfectly reconstruct from their samples by using an appropriate reconstruction filter.
We begin by noting that the DTFT of a DT signal and the CTFT of the corresponding impulse train are very closely related.

Relationship between DTFT of sampled signal and CTFT of impulse train
Suppose xs is a DT signal with DTFT Xs. Let w be the impulse train
w(t) = X1 xs[n](t nTs). (9.5)
W (!) = Xs(Ts!).
To see why this is true we directly compute the CTFT of W as
W(!) = Z 1 w(t)ej!t dt = X1 xs[n]Z 1 (tnTs)ej!t dt = X1 xs[n]ej(!Ts)n = Xs(Ts!).
1 n=1 1 n=1
CTFT of reconstructed signal
Suppose xs is a DT signal with DTFT Xs. Let w be the impulse train w(t) = X1 xs[n](t nTs).
Let h be the impulse response of a reconstruction filter and y = h ⇤ w be the reconstructed
signal. Then
where H is the CTFT of h (i.e., the frequency response of the reconstruction filter).
Y (!) = H(!)Xs(!Ts)
In Section 9.3.3 we will use this frequency domain veiwpoint to understand ideal reconstruction.
9.3.3 Ideal reconstruction and the sampling theorem
Let X be a signal with bandwidth W, such as the signal shown below: X(!)
We have seen that when Ts < ⇡/W then the DTFT of the sampled signal xs looks like a collection of shifted scaled non-overlapping copies of the CTFT of the original CT signal: 3⇡ 2⇡ ⇡WTs 0 WTs⇡ 2⇡ 3⇡ The impulse train w defined in (9.5) then has CT Fourier transform: W (!) = Xs(Ts!) 1 In this case, we can recover the CT signal by using an ideal low-pass filter with gain Ts in the passband as our reconstruction filter. 3⇡ 2⇡ ⇡W0W⇡ 2⇡ 3⇡ Ts Ts Ts Ts Ts Ts Ideal reconstruction filter In particular we can choose our reconstruction filter to have frequency response Hideal(!) = (Ts if |!| < ⇡/Ts . 0 otherwise. The corresponding impulse response is hideal(t) = sin(⇡t/Ts) = sinc(⇡t/Ts). This is shown below hideal (t) 1 8Ts 6Ts 4Ts 2Ts Ts 0 Ts 2Ts 4Ts 6Ts 8Ts Note that hideal(0) = 1 and hideal(nTs) = 0 for all n 6= 0. Using this reconstruction filter, the output y has CT Fourier transform Y (!) = Hideal(!)W(!) = Hideal(!)Xs(Ts!) = X(!) Ts Hideal(!) In particular, the reconstructed signal y has exactly the same CTFT as the input signal x, so we have succeeded in perfectly reconstructing x from its samples. Clearly this did not depend on the exact shape of the CTFT of x. All that mattered was that the sampling period was small enough so that Ts < ⇡/W and so the copies of X appearing in Xs do not overlap. 3⇡ 2⇡ ⇡W0W⇡ 2⇡ 3⇡ Ts Ts Ts Ts Ts Ts The following result summarises these observations. • This result is often called the Nyquist-Shannon sampling theorem. Sampling theorem Suppose x is a CT signal with Fourier transform X. Suppose that X(!) = 0 for |!| > W, i.e., x has bandwidth W rad/second. Suppose xs[n] = x(nTs) is the discrete-time signal obtained by sampling x with period Ts = 2⇡/!s.
If !s > 2W (or W Ts < ⇡) then the CT signal x can be perfectly reconstructed from its sam • For a given bandwidth W rad/second, the quantity 2W rad/second is often called the Nyquist rate. This is the minimum possible sampling frequency we can use if we want to be able to perfectly reconstruct all signals of bandwidth W from their samples. • Much recent reserach in signal processing has shown that we can often use many fewer samples than the sampling theorem would suggest if we have additional ‘side information’ about the signal we want to reconstruct (beyond just the fact that it has bandwidth W). To do this, it is usually essential to use non-linear reconstruction methods. 9.3.4 Ideal vs practical reconstruction The problem with ideal reconstruction is that it requires us to implement an ideal low-pass filter. This is a non-causal filter. To implement it we need to know all of the past and future values of the samples before we can perform reconstruction. In practice, especially in real-time applications, much simpler strategies like zero-order hold, are often used. Zero-order hold, causality and delay The zero-order hold reconstruction filter with impulse response hZOH(t) = u(t)u(tTs) is causal, since its output at time t o 程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com