Sampling

What is Sampling

Many signals are continuous-time signals. Since Computer can handle data, but not continuous-time signals, we need sampling - extract signals at some time instants.

1Ts=fs\frac{1}{T_s} = f_s = Sampling Frequency

ωs=2πfs\omega_s = 2\pi f_s

fs=ωs2πf_s = \frac{\omega_s}{2\pi}

ωs=ws\omega_s = ws

T=2πωsT = \frac{2\pi}{\omega_s}

Amplify a signal

Start with an analogue signal x(t)x(t).

x(t)x(t)

We use ()() to indicate that x is continuous. tt is a real number variable.

x(t)x(t) Is defined for all values of t, hence continuous.

The sampler converts x(t)x(t) to become a discrete-time signal x[n]x[n]

x[n]x[n]

We use [][] to indicate that x is discrete. nn is an integer variable.

x[n]x[n] is defined only at some time instants since n is an integer.

Discrete Time Signal

x(t)x[n]x(t) \rightarrow x[n]

x[n]=x(nTs)\mathbf{x}[\mathbf{n}]=\mathbf{x}\left(\mathbf{n} \mathbf{T}_{\mathrm{s}}\right)

  • Fourier transform

Xp(ωTs)=x(t)ejωtdtt=nTsn=x[n]ejωnTs\mathrm{X}_{\mathrm{p}}\left(\omega \mathrm{T}_{\mathrm{s}}\right)=\left.\int_{-\infty}^{\infty} \mathrm{x}(\mathrm{t}) \mathrm{e}^{-\mathrm{j} \omega \mathrm{t}} \mathrm{dt}\right|_{\mathrm{t}=\mathrm{n} T_{\mathrm{s}}} \approx \sum_{\mathrm{n}=-\infty}^{\infty} \mathrm{x}[\mathrm{n}] \mathrm{e}^{-\mathrm{j} \omega \mathrm{n} T_{\mathrm{s}}}

Note:

x(t)x(t): aperiodic continuous-time signal

x[n]x[n]: samples of x(t)x(t)

Spectrum of x(t)x(t): aperiodic

Spectrum of x[n]x[n]: periodic

What can x(t) and x[n] do?

Relationship

Relationship between the spectrum of x(t)x(t) and the spectrum of x[n]x[n] :

Xp(ωTs)=1Tsk=X(ω+2πk/Ts)ω=+1TsX(ω2π/Ts)+1TsX(ω)+1TsX(ω+2π/Ts)+\begin{aligned} \mathrm{X}_{\mathrm{p}}\left(\omega \mathrm{T}_{\mathrm{s}}\right)=& \frac{1}{\mathrm{T}_{\mathrm{s}}} \sum_{\mathrm{k}=-\infty}^{\infty} \mathrm{X}\left(\omega+2 \pi \mathrm{k} / \mathrm{T}_{\mathrm{s}}\right) \quad-\infty \leq \omega \leq \infty \\=& \ldots+\frac{1}{\mathrm{T}_{\mathrm{s}}} \mathrm{X}\left(\omega-2 \pi / \mathrm{T}_{\mathrm{s}}\right) \\ &+\frac{1}{\mathrm{T}_{\mathrm{s}}} \mathrm{X}(\omega) \\ &+\frac{1}{\mathrm{T}_{\mathrm{s}}} \mathrm{X}\left(\omega+2 \pi / \mathrm{T}_{\mathrm{s}}\right)+\ldots \end{aligned}

Too Long Didn’t read…

Basically :

x(t)x(t): aperiodic continuous-time signal

x[n]x[n]: samples of x(t)x(t) (discrete)

x(t)x[n]x(t) \rightarrow x[n] by sampling

x[n]Xp(ωTs)x[n] \rightarrow X_p(\omega T_s) by Fourier Transform

Note: Xp(ωTs)=Xs(ω)X_p(\omega T_s) = X_s(\omega)

Xp(ωTs)X_p(\omega T_s) is not discrete

x(t)X(ω)x(t) \rightarrow X(\omega) by Fourier Transform

X(ω)X(\omega) is continuous

sorry for my ugly hand-writting

Shannon sampling theorem

If a real signal is sampled at frequency fs=1/Tsf_s=1/T_s and the maximum frequency of the signal is at frequency fmaxf_{max}, then:

2πfmaxπ/Ts2 \pi \mathrm{f}_{\max } \leq \pi / \mathrm{T}_{\mathrm{s}}

2πfmaxπfs or fs2fmax\Rightarrow 2 \pi \mathrm{f}_{\max } \leq \pi \mathrm{f}_{\mathrm{s}} \text { or } \mathrm{f}_{\mathrm{s}} \geq 2 \mathrm{f}_{\max }

A continuous-time aperiodic signal x(t) with frequencies no higher than fmaxf_{max} can be reconstructed exactly from its samples x[n]=x(nTs)x[n] = x(nT_s) if the samples are taken at a rate fs=1Tsf_s = \frac{1}{T_s} that is greater than 2fmax2f_{max}

Nyquist rate: 2fmax2f_{max}

Aliasing

Alias effect: original signal cannot be reconstructed even with an ideal low pass filter.

Happens when the sampling frequency is lower than twice the Nyquist frequency.

fs<2fmaxf_s < 2f_{max}

Therefore

If ws >= 2 * max freq, then there is no overlap --> look the same

if ws < 2* max freq --> there will be overlapped, --> look different

Some Examples

Step 1: Find Frequency of the terms

10cos(20πtπ/4)=10cos(2π10tπ/4)=10cos(2πftπ/4)10cos(20\pi t - \pi/4) = 10cos(2\pi\cdot10\cdot t - \pi/4) = 10cos(2\pi ft - \pi/4)

f1=10f_1 = 10Hz

5cos(50πt)=5cos(2π25t)5cos(50\pi t) = 5cos(2\pi\cdot25\cdot t)

f2=25f_2 = 25Hz

Step 2: Use Shannon sampling theorem:

fs2fmax=fs2f2f_s \geq 2f_{max} = f_s \geq 2f_2 since f2f_2 is the max frequency

fs50f_s \geq 50Hz

(a)(a)

Step 1: Look at the table and carry out Fourier transform.

Then you get 2 pulse function.

Amplitude is 1π1\pi, and 2 pulse function on the spectrum.

(b)(b)

Step 1: Check if there is aliasing

2000Hz21000Hz2000Hz \geq 2\cdot 1000Hz

Because (fs2fmaxf_s \geq 2f_{max}) thus no aliasing

Step 2: Plug frequency into the formula. Note that

Xs(ω)=1Tk=X(ωkωs)X_{s}(\omega)=\frac{1}{T} \sum_{k=-\infty}^{\infty} X\left(\omega-k \omega_{s}\right)

Step 3: Draw a spectrum within required space (5000π-5000\pi to 5000π5000\pi) in this case

and then make the signal periodic.

Note: In the graph, x axis is ωs\omega_s and the y axis is just some π\pi value.

Amplitude : leftmost constant

Sampling range : ωs2\frac{-\omega_s}{2} to ωs2\frac{\omega_s}{2} where ωs\omega_s is the sampling frequency

Therefore Amplitude is 2000π2000\pi, sampling range is 4000π2\frac{-4000\pi}{2} to 4000π2\frac{4000\pi}{2}

(c)(c)

Step 1: Check if there is aliasing

700Hz21000Hz700Hz \leq 2\cdot 1000Hz

Because (fs2fmaxf_s \geq 2f_{max}) does not satisfy thus there is aliasing

Step 2: Plug frequency into the formula. Note that

Xs(ω)=1Tk=X(ωkωs)X_{s}(\omega)=\frac{1}{T} \sum_{k=-\infty}^{\infty} X\left(\omega-k \omega_{s}\right)

Step 3: Draw a spectrum within required space (2500π-2500\pi to 2500π2500\pi) in this case and then make the signal periodic.

Note: In the graph, x axis is ωs\omega_s and the y axis is just some π\pi value.

Amplitude : leftmost constant

Sampling range : ωs2\frac{-\omega_s}{2} to ωs2\frac{\omega_s}{2} where ωs\omega_s is the sampling frequency

Therefore Amplitude is 700π\pi, sampling range is 1400π2\frac{-1400\pi}{2} to 1400π2\frac{1400\pi}{2}

Note:

First concept:

Now you know that the max frequency is 10. fmax=10f_{max} = 10

(a)(a)

Step 1: Find frequency

ωs=30,fs=ωs2π=4.77\omega_s = 30, f_{s} = \frac{\omega_s}{2\pi} = 4.77

Step 2 : Plug frequency into the formula. Note that

Xs(ω)=1Tk=X(ωkωs)X_{s}(\omega)=\frac{1}{T} \sum_{k=-\infty}^{\infty} X\left(\omega-k \omega_{s}\right)

Sampling range : ωs2\frac{-\omega_s}{2} to ωs2\frac{\omega_s}{2} where ωs\omega_s is the sampling frequency

Lastly, make it periodic (by substituting k).

(b)(b)

Step 1: Find frequency

ωs=15,fs=ωs2π=2.39\omega_s = 15, f_{s} = \frac{\omega_s}{2\pi} = 2.39

Step 2 : Plug frequency into the formula. Note that

Xs(ω)=1Tk=X(ωkωs)X_{s}(\omega)=\frac{1}{T} \sum_{k=-\infty}^{\infty} X\left(\omega-k \omega_{s}\right)

If they overlap, the amplitude add up together

Sampling range : ωs2\frac{-\omega_s}{2} to ωs2\frac{\omega_s}{2} where ωs\omega_s is the sampling frequency

Lastly, make it periodic (by substituting k).

Video for digestion


System Analysis

What is System Analysis?

Reminder: 2 Types of signal representation.

Time domain

Frequency domain

A model to represent the system. Use the model to relate the input and output of the system.

Model

1 input 1 output.

There are two systems, Time system and discrete-time system.

Time system looks like this :

x(t) >System H{} >y(t)x(t)\space-> System\space H\{\}\space-> y(t)

and y(t)=H{x(t)}y(t) = H\{x(t)\}

Discrete-time system looks like this :

x[n] >System H{}>y[n]x[n]\space-> System\space H\{\} -> y[n]

and y[n]=H{x[n]}y[n] = H\{x[n]\}

Examples:

Types of System

To describe a system

Memory : Whether the system will remember the input or not. Only consider current input.

Causal : Only consider past and current input. will not consider any future input.

Additive : If input consist of 2 parts, then the output is the sum of the 2 individual outputs.

Homogeneous : if the input is scaled, the output is also scaled (with same constant).

Linear : Have both Additive and Homogeneous properties.

Time invariant : The output will not change with time.

Linear System

Additive

  • Output for (x1+x2) = output for x1 + output for x2

Homogeneous

  • Output for (a x1) = output of x1 scaled by a

Linear

  • Additive + Homogeneous

Nonlinear System

output = input*input

Time invariant System

If an input is delayed by t0t_0, then the output is also delayed by the same amount.

Linear time invariant (LTI) system

Many real-life systems can be approximated as linear and time invariant systems.

When a signal is fed into an LTI system, the output can be described as the convolution integral between the input signal and impulse response of the system.

Impulse response :

If input is a impulse function δ(t)\delta(t), the output will be impulse response h(t).h(t).

Convolutional Integral:

If the impulse response h(t) of an LTI system is known, the output of any input signal x(t) is the convolution integral of x(t) and h(t).

Convolution Representation of LTI Continuous-Time Systems

Basically, Remember this equation:

y(t)=0x(λ)h(tλ)dλ=x(t)h(t)y(t)=\int_{0}^{\infty} x(\lambda) h(t-\lambda) d \lambda=x(t) * h(t)

Convolution in Frequency Domain

Do you still remember this…?

Here y(t) = x(t) convolution v(t). But when it get fourier tranformed (Changed to frequency domain), it becomes Y(W) = X(W) multiply V(W).

Convolution in time domain becomes multiplication in frequency domain.

When Perform the calucation (Determine the LTI System Output using Fourier Transform)

What is meant by a system’s “impulse response” and “frequency response?”

System output =

  • Convolution of the input signal and the impulse response in time domain
  • Multiplication of the FT of the input signal and the transfer function in frequency domain

Examples of Convolution

First you need to draw the graph of x(t) and v(t). You need to know what does u(t) looks like.

Search for unit step function u(t)

y(t)=0x(λ)h(tλ)dλ=x(t)h(t)y(t)=\int_{0}^{\infty} x(\lambda) h(t-\lambda) d \lambda=x(t) * h(t)

Remember this equation, you will need a x(λ)x(\lambda) and v(tλ)v(t-\lambda) Here, where vv replace hh

First draw x(t)x(t), then replace tt with λ\lambda

Then draw v(t)v(t), then replace tt with λ\lambda. And reflect the y axis by adding a negative.

Now you can find x(λ)x(\lambda) and v(tλ)v(t-\lambda) by substituting tt.

Note : v(tλ)=v((λt))v(t- \lambda) = v(-( \lambda - t)) Therefore it should shift to right when you add a tt.

Look at the rightmost of the picture! x(λ)v(tλ)x(\lambda)v(t-\lambda) is the overlapping part between x(λ)x(\lambda) and v(tλ)v(t-\lambda). If t is ranged from 0 to 1, the value from tt to 00 is 11. Then you can calculate the integral and find tt.

Look at the rightmost of the picture! x(λ)v(tλ)x(\lambda)v(t-\lambda) is the overlapping part between x(λ)x(\lambda) and v(tλ)v(t-\lambda). If t is ranged from 1 to 2, the value from t1t-1 to 11 is 11. Then the value from tt to 22 is -1. Then you can calculate the integral and find 2t+3-2t+3.

Look at the rightmost of the picture! x(λ)v(tλ)x(\lambda)v(t-\lambda) is the overlapping part between x(λ)x(\lambda) and v(tλ)v(t-\lambda). If t is ranged from 1 to 2, the value from t1t-1 to 22 is 1-1. Then you can calculate the integral and find t3t-3.

Now by summing up the result, you get the final answer. You can substitute values of t to get the graph.

Another example of convolution

Question 1 (a) - Using the time-domain approach, determine the outputs at t = -3,-2,-1,0,1,2,3.

First, Draw h(t)h(t) and x(t)x(t), Note the input is x(t)x(t), Therefore draw x(λ)x(\lambda) and h(λ)h(-\lambda)

Then you get the graph of h(tλ)h(t-\lambda). Get the graph by substituting t = -3,-2,-1,0,1,2,3 and use the formula y(t)=x(λ)h(tλ)dλy(t)=\int_{-\infty}^{\infty} x(\lambda) h(t-\lambda) d \lambda where y(t)=x(t)h(t)y(t)=x(t) \otimes h(t).

Question 1 (b) - Using the frequency-domain approach, determine an expression for y(t)y(t).

Note Y(ω)=X(ω)H(ω)Y(\omega) = X(\omega)H(\omega).

First, find H(ω)H(\omega) and X(ω)X(\omega). Now you can find Y(ω)Y(\omega) by multiplying H(ω)H(\omega) to X(ω)X(\omega).

Then you need to tranform it back to y(t)y(t).

In this case, this transform pair is used.

(12tτ)pτ(t)τ2sinc2(τω4π)\left(1-\frac{2|t|}{\tau}\right) p_{\tau}(t) \leftrightarrow \frac{\tau}{2} \operatorname{sinc}^{2}\left(\frac{\tau \omega}{4 \pi}\right)

Now you should be able to find out y(t)y(t) and draw it out by substituting tt.

Question 2 - Evaluate the following continuous-time convolution integral

y(t)=u(t+1)u(t2)y(t)=u(t+1) \otimes u(t-2)

Lets make it y(t)=x(t)h(t)y(t)=x(t) \otimes h(t).

x(t)=u(t+1)x(t) = u(t+1), h(t)=u(t2)h(t) = u(t-2)

Note you need to draw x(λ)x(\lambda) and h(λ)h(-\lambda). Actually you can do x(λ)x(-\lambda) and h(λ)h(\lambda) instead. Same result.

Therefore, choose one function to flip. You can choose one that “seems” to be easier to flip.

I choose to flip u(t+1)u(t+1) here, therefore I get x(λ)=u(λ+1)x(-\lambda) = u(-\lambda + 1).

Then you get the graph of x(tλ)x(t-\lambda). Get the graph by substituting t and use the formula y(t)=h(λ)x(tλ)dλy(t)=\int_{-\infty}^{\infty} h(\lambda) x(t-\lambda) d \lambda where y(t)=x(t)h(t)y(t)=x(t) \otimes h(t).

Note if there is no overlap, y(t)=0y(t) = 0. If there is overlap, you know what to do.

Video for digestion