Sampling

Computer cannot handle continuous-time signals, therefore We need Sampling.

x(t)=Acos(2πfot+ϕ)x(t)=A \cos \left(2 \pi f_{o} t+\phi\right)

x[n]=x(nTs)=Acos(2πfonTs+ϕ)=Acos(2πnfofs+ϕ)x[n]=x\left(n T_{s}\right)=A \cos (2 \pi f_{o} n T_{s}+\phi) = Acos(2 \pi n \frac{f_{o}}{f_s} +\phi)

Reconstruct x(t) with x[n]

you can reconstruct the original singal from its sampled version IF:

  • sampling rate is high enough

Shannon Sampling Theorem

For distinguishing whether the sample sequence is from which signal.

If the maximum frequency component in x(t)x(t) is fmaxf_{max}

The sampling frequency fsf_s must be 2fmax\geq 2f_{max}.

12fsfmax\frac{1}{2}f_s \geq f_{max}

Otherwise x(t)x(t) cannot reconstruct from the samples.

In other words

  • The sampling frequency must be at least a double of the signal bandwidth.
    • Denoted as B0.5ωsB \leq 0.5\omega_s
    • or Denoted as ωs2B\omega_s \geq 2B

Note: bandwidth = highest frequency component - lowest frequency component = fmax0f_{max} - 0

lowest frequency component is 00 because it is always the DC component.

Nyquist sampling frequency

The Minimum sampling frequency fs=2fmaxf_s = 2f_{max}

Aliasing

  • If Aliasing occur, it is impossible to reconstruct the signal from the sampled signal.
    • Aliasing occur when B>0.5ωsB > 0.5\omega_s (which means fmax>12ωsf_{max} > \frac{1}{2}\omega_s)
  • If No Aliasing occur, it is possible to reconstruct the signal from the sampled signal.
    • No Aliasing occur when B0.5ωsB \leq 0.5\omega_s (which means fmax12ωsf_{max} \leq \frac{1}{2}\omega_s)

Sampling Output

fs=ws2πf_s = \frac{w_s}{2\pi}

ws=2πfsw_s = 2\pi f_s

Xs(ω)=k=1TsX(ωkωs)=k=fsX(ωkωs)X_{s}(\omega)=\sum_{k=-\infty}^{\infty} \frac{1}{T_{s}} X\left(\omega-k \omega_{s}\right) = \sum_{k=-\infty}^{\infty} f_s X\left(\omega-k \omega_{s}\right)

Signal Reconstruction by interpolation

Lowpass filtering is used to reconstructed a CT signal with its sampled version.

Aliasing problem can be reduced by Lowpass filtering the signal.

Lowpass filtering is generally performed before sampling to satisfy the rule.

Cutoff frequency is at most half of the sampling rate

cutoff frequency = sampling frequency/2

Low pass filter / Interpolation filter

Suppose that x(t) has bandwidth B,

X(ω)=0 for ω>B|X(\omega)|=0 \quad \text { for } \omega>B

The frequency response function of the interpolation filter is

H(ω)={TsBωB0 otherwise H(\omega)=\left\{\begin{array}{cc} T_{s} & -B \leq \omega \leq B \\ 0 & \text { otherwise } \end{array}\right.

=>h(t)=BTsπsinc(Btπ)=> h(t) = \frac{BT_s}{\pi} sinc(\frac{Bt}{\pi})

Now we look at the output.

y(t)=h(t)xs(t)y(t) = h(t)\otimes x_s(t)

Where

xs(t)=n=x(nTs)δ(tnTs)x_s(t) = \sum_{n=-\infty}^{\infty} x\left(n T_{s}\right) \delta\left(t-n T_{s}\right)

To find y(t)y(t):

y(t)=h(t)xs(t)=BTπn=x(nT)sinc(Bπ(tnT))y(t) = h(t)\otimes x_s(t) = \frac{BT}{\pi} \sum_{n=-\infty}^{\infty} x(nT)sinc(\frac{B}{\pi}(t - nT))

Practice Questions - Sampling

![]

Q1.

Keypoint: Use this formula to sketch the graph.

Xs(ω)=k=1TsX(ωkωs)=k=fsX(ωkωs)X_{s}(\omega)=\sum_{k=-\infty}^{\infty} \frac{1}{T_{s}} X\left(\omega-k \omega_{s}\right) = \sum_{k=-\infty}^{\infty} f_s X\left(\omega-k \omega_{s}\right)

Where fsf_s is the height of your graph Xs(ω)X_s(\omega).

First locate the Bandwidth (Maximum frequency).

In this case, Maximum frequency = 10.

(a)

fs=302πf_s = \frac{30}{2\pi} Hz

ωs=2πfs\omega_s = 2\pi f_s Therefore ws=30w_s = 30

Since ws>2Bw_s > 2B, No aliasing occur.

(b)

fs=152πf_s = \frac{15}{2\pi} Hz

ωs=2πfs\omega_s = 2\pi f_s Therefore ws=15w_s = 15

Since ws<2Bw_s < 2B, Aliasing occur.

Q2

First Identify the frequency from the signal.

x(t)=10cos(2π10tπ/4)5cos(2π25t)x(t) = 10cos(2\pi 10t-\pi/4) - 5cos(2\pi25t)

x(t)x(t) has 2 frequencies : f1=10f_1 = 10Hz and f2=25f_2 = 25Hz

Maximum frequency = 25Hz

Nyquist sampling frequency = 25×2=5025 \times 2 = 50Hz

Therefore the fsf_s has to be at least 50Hz such that y(t)=x(t)y(t) = x(t).

Q3

(a)

Given Ts=50×103T_s = 50 \times 10^{-3}

Find fsf_s first.

fs=150×103=20f_s = \frac{1}{50\times 10^-3} = 20Hz

nTs=n20nT_s = \frac{n}{20}

x[n]=x(nTs)x[n] = x(nT_s)

Therefore x[n]=44cos(2π(35)n20π4)+82cos(2π(10)n20π5)x[n] = 44cos(2\pi(35)\frac{n}{20} - \frac{\pi}{4}) + 82cos(2\pi(10)\frac{n}{20}-\frac{\pi}{5})

=44cos(2π7n4π4)+82cos(2πn2π5)= 44cos(2\pi\frac{7n}{4} - \frac{\pi}{4}) + 82cos(2\pi\frac{n}{2}-\frac{\pi}{5})

=44cos(7πn2π4)+82cos(nππ5)= 44cos(\frac{7\pi n}{2} - \frac{\pi}{4}) + 82cos(n\pi-\frac{\pi}{5})

=44cos(2π(7πn2π4))+82cos(nππ5)= 44cos(2\pi - (\frac{7\pi n}{2} - \frac{\pi}{4})) + 82cos(n\pi-\frac{\pi}{5})

=44cos(πn2+π4)+82cos(nππ5)= 44cos(\frac{\pi n}{2} + \frac{\pi}{4}) + 82cos(n\pi-\frac{\pi}{5})

=44cos(2πn14+π4)+82cos(2πn12π5)= 44cos(2\pi n\frac{1}{4} + \frac{\pi}{4}) + 82cos(2\pi n\frac{1}{2}-\frac{\pi}{5})

(b)

Reconstructed frequencies

fmax=35f_{max} = 35Hz

Need 7070Hz therefore Aliasing occurs

g[n]=cos(2πn(fofs)+ϕ)g[n] = cos(2\pi n(\frac{f_o}{f_s}) + \phi)

Now lets find the frequencies of the reconstructed frequency components:

fo20=14\frac{f_o}{20} = \frac{1}{4}

fo=5f_o = 5Hz

fo20=12\frac{f_o}{20} = \frac{1}{2}

fo=10f_o = 10Hz

the frequencies of the reconstructed frequency components

  • 5Hz
  • 10Hz

Z-transform

Relationship Between DFT and Z-Transform

when a finite number of samples (N) are considered, the N-point DFT is expressed as:

X(m)=n=0N1x(n)ej(2π/N)mnX(m)=\sum_{n=0}^{N-1} x(n) e^{-j(2 \pi / N) m n}

while Z transform is expressed as:

X(z)=n=x(n)znX(z)=\sum_{n=-\infty}^{\infty} x(n) z^{-n}

So you can see the relationship.

z=ej(2πN)m=ejθz = e^{j(\frac{2\pi}{N})m} = e^{j\theta}

θ[0,2π]\theta \in[0,2 \pi] is actually the radian frequency.

Connection between DFT & Z transform

Discrete signals can be expressed in the sampled-time, frequency, and z-plane domains.

Important Properties of Z-transform

Z-transform Time shift property

x(nm)zmX(z)x(n-m) \Leftrightarrow z^{-m} X(z)

Z-transform of delta

δ(n)1\delta(n) \Leftrightarrow 1

Z-transform convolution property

h(n)x(n)H(z)X(z)h(n) * x(n) \Leftrightarrow H(z) X(z)

Z-transform of shifted delta

δ(nm)zm,z>1\delta(n-m) \Leftrightarrow z^{-m},|z| > 1

zn+zn2cosnΩz^{n}+z^{-n} \rightarrow 2 \cos n \Omega

IIR/FIR filters

Basic elements for constructing a DSP system

Note:

  • Delay Block is fixed. Each use of delay block means we delay the output by 1 sample period.
  • Multiplier g can be any number (0 => disconnected)
  • Summing block can be used as subtracter by denoting - next to the arrow from the function you want to subtract.

Transfer function

Transfer function H(z)H(z) of the digital filter:

H(z)=Y(z)X(z)=i=0Maizi(1+i=1Nbizi)H(z)=\frac{Y(z)}{X(z)}=\frac{\sum_{i=0}^{M} a_{i} z^{-\mathrm{i}}}{\left(1+\sum_{i=1}^{N} b_{i} z^{-\mathrm{i}}\right)}

Zeros and Poles

  • Roots of Y(z)=0Y(z) = 0 are called Zeros.
    • Attenuate (reduce) particular frequency component
  • Roots of X(z)=0X(z) = 0 are called Poles.
    • Emphasize particular frequency components

  • If Zeros (O) and Poles (X) overlap, they can be canceled each other.
  • if Pole = 0, it means a delay.
  • A filter is stable if the absolute value of Pole < 1.
    • FIR must be stable (No Pole).

Find Transfer function from a difference equation

  1. Transform a difference equation into Z-domain.
  2. Write Transfer function H(z)H(z) by change of subject.
  3. Then you can find Zeros and Poles as well.

IIR/FIR filters

Finite impulse response (FIR) filter

FIR - All bib_i = 0

Basically X(z)=1X(z) = 1

Only Zeros, no Poles. (Pole = 0)

independent of previous y output

Example:

  • FIR filter is a LTI system. (Linear and Time-Invariant)

Signature of FIR

  • Difference equation

y[n]=i=0Maix[ni]y[n]=\sum_{i=0}^{M} a_{i} x[n-i]

  • Unit pulse response

h[n]=i=0Maiδ[ni]h[n]=\sum_{i=0}^{M} a_{i} \delta[n-i]

  • Transfer function

H(z)=Y(z)X(z)=i=0MaiziH(z)=\frac{Y(z)}{X(z)}=\sum_{i=0}^{M} a_{i} z^{-i}

  • Power spectrum

H(z)H(1/z)z=ejω=(i=0Maiejiω)2|H(z) H(1 / z)|_{z=e^{j \omega}}=\left|\left(\sum_{i=0}^{M} a_{i} e^{-j i \omega}\right)\right|^{2}

Infinite impulse response (IIR) filter

IIR is a bit complicated than FIR.

IIR - Not all bib_i = 0 (Have feedback)

Basically a Fractional Polynomial

Why are FIR filters still stable even though they contain poles?

Example:

Signature of IIR

  • Difference equation (Not all bi=0b_i = 0)

y[n]=i=0Maix[ni]i=1Nbix[ni]y[n]=\sum_{i=0}^{M} a_{i} x[n-i] - \sum_{i=1}^{N} b_{i} x[n-i]

  • Unit pulse response (hih_i is a function of ana_n and bnb_n)

h[n]=i=0hiδ[n]h[n]=\sum_{i=0}^{\infty} h_{i} \delta[n]

  • Transfer function

H(z)=Y(z)X(z)=i=0Maizi1+i=1NbiziH(z)=\frac{Y(z)}{X(z)}=\frac{\sum_{i=0}^{M} a_{i} z^{-i}}{1+\sum_{i=1}^{N} b_{i} z^{-i}}

  • Power spectrum

H(z)H(1/z)z=ejω=(i=0Maiejiω1+i=1Nbiejiω)2|\left.H(z) H(1 / z)\right|_{z=e^{j \omega}}=| (\frac{\sum_{i=0}^{M} a_{i} e^{j i \omega}}{1+\sum_{i=1}^{N} b_{i} e^{j i \omega}})|^2

Filter design

Adjust poles and zeros of the filter to determine the frequency response of the filter.

  • Adjust zeros to kill/attenuate selected frequencies.
  • Adjust poles to amplify selected frequencies.

You can reduce cost on filter design.

Useful Info

Power frequency response

P(θ)=H(ejθ)2=H(z)H(1z)z=ejθP(\theta) = |H(e^{j\theta})|^2 = H(z) H\left(\frac{1}{z}\right)|_{z=e^{j\theta}}

Amplitude response

A(θ)=P(θ)A(\theta) = \sqrt{P(\theta)}

Filters

Lowpass Filter (LPF)

A System that:

  • Passes Low-frequency signals
  • Attenuates (reduce) signals with frequencies higher than the cutoff frequency

LF > HF = Lowpass Filter

Highpass Filter (HPF)

A System that:

  • Passes High-frequency signals
  • Attenuates (reduce) signals with frequencies lower than the cutoff frequency

HF > LF = Highpass Filter

Bandpass Filter (BPF)

A System that:

  • Passes frequencies within a certain range
  • rejects/ attenuates frequencies outside that range

BF > HF and LF = Bandpass Filter

Cascade/Decomposition of systems

A polynomial (the transfer function of a system) can always be factorized and decomposed.

H(z)=H1(z)H2(z)=Ha(z)+Hb(z)H(z) = H_1(z)H_2(z) = H_a(z) + H_b(z)

This means as long as you know how to handle a simple system (1st or 2nd order system), you can handle any complicated system by

  • decomposing it into a cascade of simple systems with simple algebras
  • then handling them one by one

Significance of Zeros and Poles

Zeros

You can design a FIR filter to remove any frequency components you don’t like by placing zeros at the right positions on the unit circle.

With placing Zeros into correct positions, LPF, BPF or HPF nature based filters can be designed.

Poles

  • If absolute value of pole < 1, the filter will be stable.
  • If absolute value of pole = 1 , the filter will oscillate or be steady
  • If absolute value of pole > 1, the filter will be unstable. (Unstable means the filter is not usable)

The pole position will also determine whether the filter is LPF or HPF.

  • If Pole is in Positive
    • Decays if Pole < 1 (stable)
    • Grows to infinity if Pole > 1 (Not stable)
    • It is a LPF (Low Pass Filter)
  • If Pole is in Negative
    • Decays if Pole > -1 (stable)
    • Grows to infinity if Pole < -1 (Not stable)
    • It is a HPF (High Pass Filter)

Practice Questions - Filter and Z transform

(a)

8z2+2z1z2\frac{8z^2+2z-1}{z^2}

(b)

Poles = 0

=> System is stable because pole < 1

©

It is a FIR because the current output sample y[n] is independent of any previous y samples.

(d)

69+28cos(Ω)16cos(2Ω)69+28cos(\Omega)-16cos(2\Omega)

(e)

It is LPF.

(f)

Hint: Try to minimise the usage of Delay blocks.

(a)

2z1z(z1)\frac{2z-1}{z(z-1)}

(b)

Poles = 1 or 0

=> Not stable because one of the poles is not < 1.

©

This filter is an IIR as current output sample y[n] is dependent of previous sample y[n-1].

(d)

54cos(Ω)22cos(Ω)\frac{5-4cos(\Omega)}{2-2cos(\Omega)}