ee 102b: signal processing and linear systems ii · ee 102b: signal processing and linear systems...
TRANSCRIPT
EE 102b: Signal Processing and Linear Systems IIMidterm Review
Signals and Systems
Sampling and Reconstruction vs. Analog-to-Digital and Digital-to-Analog Conversion
l Sampling: converts a continuous-time signal to a continuous-time sampled signal
l Reconstruction: converts a sampled signal to a continuous-time signal.
l Analog-to-digital conversion: converts a continuous-time signal to a discrete-time quantized or unquantized signal
l Digital-to-analog conversion. Converts a discrete-time quantized or unquantized signal to a continuous-time signal.
0 Ts 2Ts 3Ts 4Ts-3Ts -2Ts -Ts
0 1 2 3 4-3 -2 -1
0 Ts 2Ts 3Ts 4Ts-3Ts -2Ts -Ts
0 1 2 3 4-3 -2 -1
Each level canbe representedby 0s and 1s
xs(t)
Sampling
l Sampling (Time):
l Sampling (Frequency): x(t)p(t) X(jw)*P(jw)/(2p)
l Analog-to-Digital Conversation (ADC)l Setting xd[n]=x(nTs) yields Xs(ejW) with W=wTs
0
x(t) =p(t)=ånd(t-nTs)
Xs(jw)
0 0 0
X(jw) =ånd(w-(2pn/Ts))*
0 Ts 2Ts 3Ts 4Ts-3Ts -2Ts -Ts0 Ts 2Ts 3Ts 4Ts-2Ts -Ts-3Ts
2pTs
-2pTs
2pTs
-2pTs
𝟐𝝅𝑻𝒔
1 1/Ts
Reconstructionl Frequency Domain: low-pass filter (Ts=p/W)
l Time Domain: sinc interpolation
l Digital-to-Analog Conversation (DAC)l LPF applied to Xs(ejW) and then converted to
continuous time (w=W/Ts) recovers sampled signal
Xs(jw)
0 2pTs
-2pTs
W-W w
Ts
w
H(jw)
0-2pTs
Xs(jw)
2pTs
Xr(jw)
( ) ( ) åå¥
-¥=
¥
-¥=÷÷ø
öççè
æ -=-=n s
sss
nsssr T
nTtnTxnTthnTxtx sinc)()(
H(jw)
Nyquist Sampling Theoreml A bandlimited signal [-W,W] radians is completely described
by samples every Ts£p/W secs.
l The minimum sampling rate for perfect reconstruction, called the Nyquist rate, is W/p samples/second
l If a bandlimited signal is sampled below its Nyquist rate, distortion (aliasing occurs)
Xs(jw)X(jw)
W-W WW
X(jw)
2W=2p/Ts-2W 00
Quantization
l Divide amplitude range [-A,A] into 2N levels, {-A+kD}, k=0,…2N-1l Map x(t) amplitude at each Ts to closest level, yields xQ(nTs)=xQ[n]l Convert k to its binary representation (N bits); converts xQ[n] to bits
-A
A
-A+D-A+2D
-A+kD
……
Ts 2Ts …0
xQ(nTs)x(t)
Continuous-TimeUnquantized
x(t) nTt =Anti-AliasingLowpass Filter
Bandlimits x(t) toprevent aliasing
Sampler
Quantizer
Discrete-TimeUnquantized
xd[n] = x(t)| t = nT
Discrete-TimeQuantized Representation
of xd[n] …
Digital Storage,Transmission,
Signal Processing, …
Discrete-TimeQuantized y[n] Reconstruction
SystemContinuous-Time
y(t)
Analog to Bits and Back
Continuous-TimeUnquantized
x(t) nTt =Anti-AliasingLowpass Filter
Bandlimits x(t) toprevent aliasing
Sampler
Quantizer
Discrete-TimeUnquantized
xd[n] = x(t)| t = nT
Discrete-TimeQuantized Representation
of xd[n] …
Digital Storage,Transmission,
Signal Processing, …
Discrete-TimeQuantized y[n] Reconstruction
SystemContinuous-Time
y(t)
Analog to Bits
Bits to Analog
0100100110010010000100001000100111…
0100100110010010000100001000100111…
ADC
DAC
Sampling with Zero-Order Hold
l Ideal sampling not possible in practicel In practice, ADC uses zero-order
hold to produce xd[n] from x0(t)l Reconstruction of x(t) from x0(t) removes h0(t) distortion
l Multiplication in frequency domain by P 𝝎𝝎𝒔
/H0(jw)
l Also use zero-order hold for reconstruction in practice
R1
R2
xd(t) h0(t)1
Ts
x0(t)Hr(jw)
xr(t)=x(t)DiscreteTo
Continuous
xd[n]=x(nTs)
xs(t)ånd(t-nTs)
0 Ts 2Ts 3Ts 4Ts-3Ts -2Ts -Ts
x(t)´
xs(t) h0(t)1
Ts
x0(t) x0(t)xd[n] (Ts=1)
X(jw)
Xs(jw) |H0(jw)|
|X0(jw)|
|Hr(jw)|
x(t)´
xs(t) h0(t)1
T
x0(t)
ånd(t-nTs)
Hr(jw)xr(t)=x(t)
Ho(jw)Hr(jw)=T&P 𝝎𝝎𝒔
T
Zero-order hold model
l Inserts L-1 zeros between each xd[n] value to get upsampledsignal xe[n]
l Compresses Xd(ejW) by L in W domain and repeats it every 2p/L; So Xe(ejW) is periodic every 2p/L
l Leads to less stringent reconstruction filter design than ideal LPF: zero-order hold often used
Discrete-Time Upsampling
0 1 2 3 4 0 L 2L 3L 4L
xd[n] xe[n]
0 p-pW
Xd(ejW)
WW-WW
WW=WTs
2p-2p W
Xe(ejW)
WW-WW
L L
… …
2pL
-2pL
xe[n]UpsampleBy L (L)
xd[n]=x(nTs)
0w
X(jw)
W-W
Reconstruction of Upsampled Signal
l Pass through an ideal LPF Hi(ejW) to get xi[n] l xi[n]=ẋe[n]=x(nTs/L) if x(t) originally sampled at Nyquist rate (Ts<p/W)l Relaxes DAC filter requirements (approximate LPF/zero-order hold
reconstructs x(t) from xi[n]); better filter to reconstruct from xd[n] needed)
0p-p W
xd[n]=x(nTs)ÛXd(ejW)
WW-WW
Hi(ejW)
2p-2p W
Xe(ejW)
WW-WW
L L
0 L 2L 3L 4L
xe[n]
0 1 2 3 4
xd[n]
xi[n]xe[n]UpsampleBy L
xd[n]=x(nTs)
2pL
-2pL
0 L 2L 3L 4L
xi[n]
Xi(ejW) Û xi[n]Xi(ejW)
x(t)DAC
Reconstruct x(t) from xi[n] by passing it through a DAC
… …
More stringent LPF than for Xd(ejW) Less stringent analog LPFthan to reconstruct from xd[n]
=ẋe[n]
xi[n]=ẋe[n]=x(nTs/L) if Ts<p/W
DiscreteTo Cts Ha(jw)
Ha(ejW)
Ha(ejW)
xi[n] x(t)xr(t)≠x(t)
xd[n]
0 2p-2p W
Xd(ejW)W=wTs
0 2pTs
-2pTs
w
Xs(jw)Ts
0w
X(jw)
W-W
Ts/L
0 2p-2p W
Xe(ejW)W=wTs/L
0w
X(jw)
W-W 0 2pLTs
-2pLTs
w
Xs(jw) .
2p-2p 2p/L-2p/L W
Xe(ejW)
… …
Xi(ejW)=Lrect[WL/(2p)]
��𝑒 𝑒*+,-// 𝐿rect 56789: =𝑋; 𝑒*+,-// 𝐿rect 5678
9:
=𝑋𝑒 𝑒*+,- 𝐿rect 56789: =𝑋𝑒 𝑒*< 𝐿rect =8
9: =𝑋𝑖 𝑒*<
��𝑒 𝑛 ≜ 𝑥 B,7/
⇔𝑋-
678 𝑗𝜔
⇒��𝑒 𝑒*< = ��𝑒
𝑒*+,-// =��𝑒 𝑒*+,-// 𝐿rect 56789:
0 L 2L 3L 4L
xe[n]
0 1 2 3 4
xd[n]=Xe(ejW)
xi[n]=ẋe[n]=x(nTs/L)if Ts<p/W
Proof that xi[n]=ẋe[n]«Xi(ejW) =Xe(ejW)
Digital Downsampling:Fourier Transform and Reconstruction
l Digital Downsamplingl Removes samples of x(nTs) for n≠MTsl Used under storage/comm. constraints
l Repeats Xd(ejW) every 2p/M and scales W axis by Ml This results in a periodic signal Xc(ejW) every 2pl Introduces aliasing if Xd(ejW) bandwidth exceeds p/Ml Can prefilter Xd(ejW) by LPF with bandwith p/M prior to
downsampling to avoid downsample aliasing
xc[n]DownsampleBy M
xd[n]=x(nTs)
0 1 2 3 40 123 …
0 p/M-p/M W’
Xd(ejW’)
0 p-p
Xc(ejW)
-2p 2p
……0 p/M-p/M W’
Xd(ejW’)
0 p-p
Xc(ejW)
-2p 2p
……
W=MW’W=MW’
𝑋𝑐 𝑒*< = JK L 𝑋𝑑 𝑒*(<OPQR)/KKOJ
RTU
xd[n]
0123… 0 2p-2p -p/M p/M W
Xd(ejW)
(9)
0 2p-2p W
Xd(ejW)W=wTs
0 2pTs
-2pTs
w
Xs(jw)Ts
0w
X(jw)
W-W
𝑋𝑑 𝑒*< = J,-∑ 𝑋 𝑗 =W9:X
67YZTOY
MTs
0 2p-2p W
Xc(ejW)W=wMTs
0w
X(jw)
W-W 0 2pMTs
-2pMTs
w
Xs(jw) 𝑋𝐶 𝑒*< = JK,-
∑ 𝑋 𝑗 =W9:\]67
Y^TOY
𝑋𝐶 𝑒*< =1𝑀𝑇𝑠
L 𝑋 𝑗 <OPQ^K,-
=1𝑀 L
1𝑇𝑠
L 𝑋 𝑗 <OPQ(ZKcR)K,-
Y
ZTOY
KOJ
RTU
= JK L 𝑋𝑑 𝑒*(<OPQR)/KKOJ
RTU
Y
^TOY
𝑙 = 𝑘𝑀 +𝑚:L =L L Y
ZTOY
KOJ
RTU
Y
^TOY
0 1 2 3 4
xc[n]=xd[nM]
0 2p-2p p-p W
Xc(ejW)
Repeats Xd(ejW) every 2p/M and scales W axis by M
Communication System Block Diagram
l Modulator (Transmitter) converts message signal or bits into format appropriate for channel transmission (analog signal).
l Channel introduces distortion, noise, and interference.
l Demodulator (Receiver) decodes received signal back to message signal or bits.
l Focus on modulators with s(t) at a carrier frequency wc. Allows allocation of orthogonal frequency channels to different users
ChannelDemodulator
(Receiver)Modulator
(Transmitter)
)(ts )(ˆ ts)(ˆ...ˆˆ21
tmbb)(:signal analog
...:bits 21
tmbb
Amplitude ModulationDSBSC and SSB
l Double sideband suppressed carrier (DSBSC) l Modulated signal is s(t)=m(t)cos(wct)l Signal bandwidth (bandwidth occupied in positive frequencies) is 2W
l Redundant information: can either transmit upper sidebands (USB) only or lower sidebands (LSB) only and recover m(t)l Single sideband modulation (SSB); uses 50% less bandwidth (less $$$)
l Demodulator for DSBSC/SSB: multiply by cos(wct) and LPF
))](())(([5.)cos()()( ccc jMjMttmts wwwww ++-Û=)( wjS)( wjM
LSB
USB USB
W-W w wwc-wc
W 2W
wc-wc X
cos(wct)s(t)
2wc0-2wc
AM Radio
l Broadcast AM has s(t)=[1+kam(t)]cos(wct) with [1+kam(t)]>0l Constant carrier cos(wct) carriers no information; wasteful of powerl Can recover m(t) with envelope detector (diode, resistors, capacitor)l Modulated signal has twice bandwidth W of m(t), same as DSBSC
m(t) X
cos(wct)
+
A s(t)=[A+kam(t)]coswct
1/(2pwc)<<RC<<1/(2pW)
ka
1
)( wjM
W-W
ka
wc-wc
)( wjM
W-W
Quadrature Modulation
DSBSCDemod
DSBSCDemod
m1(t)cos(wct)+m2(t)sin(wct)
LPF
LPF
-90o
cos(wct)
sin(wct)
Sends two info. signals on the cosine and sine carriers
m1(t)
m2(t)
Digital Communication System Block Diagram
l Channel is a physical entity (wire, cable, wireless channel, string)l Cannot send a complex signal over a physical channel: s(t) must be real
l S(jw)=S*(-jw): s(t) real/even ® S(jw) real/even; s(t) real/odd ® S(jw) imaginary/oddl Often write s(t) in terms of in-phase/quadrature components: s(t)=sI(t)cos(wct)-sQ(t)sin(wct)
ADCAnalogSource
AnalogSink DAC
Compression
Decompression
Error-CorrectionEncoding
Error-CorrectionDecoding
BasebandModulation
BasebandDemodulation
PassbandModulation
PassbandDemodulation
Channel
ModulatedWaveform
s(t)
ŝ(t): Corrupted
Copyof s(t)
CompressedSource Bits
EncodedBits
BasebandWaveform
m(t)
DemodulatedWaveform𝑚i (t)
DecodedCompressedSource Bits
DetectedEncoded
Bits
convertscontinuous-time
to bits
Removes redundancy introducescontrolled
redundancy
binary ormulti-level
shifts waveformto carrierfrequency
propagates signalbut adds
distortion, noise& interference
shifts waveformto baseband
compareswaveform tothresholds
to detect bits
correctserrors in
detected bits
restoressource
redundancy
convertsbits to
continuous-time Analog System
Digital SourceBits
Bits
Digital Sink Bits
l Baseband digital modulation converts bits into analog signals y(t) (bits encoded in amplitude)
l Pulse shaping (optional topic)l Instead of the rect function, other pulse shapes usedl Improves bandwidth properties and timing recoveryl Explored in extra credit Matlab problem
Baseband Digital Modulation
1 0 1 1 0 1 0 1 1 0On-Off Polar
t tTb
)()()(*)()()( bk
kbk
k kTtatxfortrecttxkTtrectatm -==-= åå¥
-¥=
¥
-¥=
d
m(t)m(t)A A
-A
l Changes amplitude (ASK), phase (PSK), or frequency (FSK, no covered) of carrier relative to bits
l We use baseband digital modulation as information signal m(t) to encode bits, i.e. m(t) is on-off or polar
l Passband digital modulation for ASK/PSK is a special case of DSBSCl For m(t) on/off (ASK) or polar (PSK), modulated signal is
Passband Digital Modulation
)cos()()cos()()( tkTtrectattmts cbk
kc ww úû
ùêë
é -== å¥
-¥=
ASK and PSK
l Amplitude Shift Keying (ASK)
l Phase Shift Keying (PSK)
îíì
==
==)"0("0)(0)"1(")()cos(
)cos()()(b
bcc nTm
AnTmtAttmts
ww
1 0 1 1
AM Modulation
AM Modulation
m(t)
m(t)
îíì
-=+=
==)"0(")()cos()"1(")()cos(
)cos()()(AnTmtAAnTmtA
ttmtsbc
bcc pw
ww
1 0 1 1
Assumes carrier phase f=0, otherwise need phase recovery of f in receiver
A
-A
A
-A
ASK/PSK Demodulationl Similar to AM demodulation, but only need to choose
between one of two values (need coherent detection)
l Decision device determines which of R0 or R1 that R(nTb) is closest tol For ASK, R0=0, R1=A, For PSK, R0=-A, R1=Al Noise immunity DN is half the distance between R0 and R1
l Bit errors occur when noise exceeds this immunity
s(t) ´
cos(wct+f)
ò ×bT
b
dtT 0
)(2
nTb
Decision Device
“1” or “0” r(nTb)
R0
R1
a0
r(nTb)
r(nTb)+N
Integrator (LPF)
DN
Quadrature Digital Modulation: MQAM
l Sends different bit streams on the sine and cosine carriersl Baseband modulated signals can have L>2 levels
l More levels for the same TX power leads to smaller noise immunity and hence higher error probability:
l Sends 2log2(L)=M bits per symbol time Ts, Data rate is M/Ts bpsl Called MQAM modulation: 10 Gbps WiFi: 1024-QAM (10 bits/10-9 secs)
● L=32 levels
10 11 00 01
t
mi(t)m1(t)cos(wct)+m2(t)sin(wct)+
n(t)
X
-90o
cos(wct)
sin(wct)
X
ò ×bT
b
dtT 0
)(2
ò ×bT
b
dtT 0
)(2
Decision Device
“1” or “0”
R0
R1
a0
rI(nTb)+NI
Decision Device
“1” or “0”
R0
R1
a0
rQ(nTb)+NQ
A
-A
A/3
-A/3
Ts
Data rate: log2L bits/TsTs is called the symbol time
Introduction to FIR Filter Design
l Signal processing today done digitallyl Cheaper, more reliable, more energy-efficient, smaller
l Discrete time filters in practice must have a finite impulse response: h[n]=0, |n|>M/2l Otherwise processing takes infinite time
l FIR filter design typically entails approximating an ideal (IIR) filter with an FIR filterl Ideal filters include low-pass, bandpass, high-passl Might also use to approximate continuous-time filter
l We focus on two approximation methodsl Impulse response and filter response matchingl Both lead to the same filter design
Impulse Response Matchingl Given a desired (noncausal, IIR) filter response hd[n]
l Objective: Find FIR approximation ha[n]: ha[n]=0 for |n|>M/2 to minimize error of time impulse response
l By inspection, optimal (noncausal) approximation is
[ ] ( )W« jdd eHnh
[ ] [ ] [ ] [ ] [ ] 2/||,0][since,
2
2
2
22 Mnnhnhnhnhnhnh aMn
dMn
adn
ad >=+-=-= ååå>£
¥
-¥=
eDoesn’t depend on ha[n]
[ ] [ ]îíì
>£
=2/02/
MnMnnh
nh da
Exhibits Gibbs phenomenonfrom sharp time-windowing
W
( )Wja eH
p- p0
Frequency Response Matchingl Given a desired frequency response Hd(ejW)
l Objective: Find FIR approximation ha[n]: ha[n]=0 for |n|>M/2 that minimizes error of freq. response
l Set and
l By Parseval’s identity:l Time-domain error and frequency-domain error equall Optimal filter same as in impulse response matching
( ) ( )ò-
WW W-=p
pp
e deHeH ja
jd
2
21
[ ] ( )òå-
W¥
-¥=
W=p
ppdeXnx j
n
22
21
[ ] [ ] [ ]nhnhnx ad -= ( ) ( ) ( )WWW -= ja
jd
j eHeHeXand
[ ] [ ]îíì
>£
=2/02/
MnMnnh
nh da 2/||)(
21][ MndeHnh j
da £W= W
-òp
pp
Causal Design and Group Delayl Can make ha[n] causal by adding delay of M/2l Leads to causal FIR filter design
l If ÐHa(ejW) constant, ÐH(ejW) linear in W with slope -.5Ml Most filter implementations do not have linear
phase, corresponding to a constant delay for all W. l Group delay defined as
l Constant for linear phase filtersl Piecewise constant for piecewise linear phase filtersl Nonconstant group delay introduces phase distortion
relative to an ideal filter
[ ] úûù
êëé -=
2Mnhnh a ( ) [ ] W-
=
W å= jnM
n
j enheH0
( ) ( )WW-W = ja
Mjj eHeeH 2
)( WÐW¶¶
- jeH
Art and Science of Windowingl Window design is created as an alternative to the
sharp time-windowing in ha[n]l Used to mitigate Gibbs phenomenonl Window function (w[n]=0, |n|>M/2) given by
l Windowed noncausal FIR design:
l Frequency response smooths Gibbs in Ha(ejW)
l Design often trades “wiggles” in main vs. sidelobesl Hamming smooths out wiggles from rectangular windowl Introduces more distortion at transition frequencies than rectangle
[ ] ( )W« jeWnw
[ ] [ ] [ ] [ ] [ ]nhnwnhnwnh daw ×=×=
( ) ( ) ( )( ) qp
qp
p
q deHeWeH jd
jjw
-W
-
W ò=21
Typical Window Designs
-5 0 50
0.5
1
n
w[n]
boxcar(M+1), M = 8
-5 0 50
0.5
1
n
w[n]
triang(M+1), M = 8
-5 0 50
0.5
1
n
w[n]
bartlett(M+1), M = 8
-5 0 50
0.5
1
n
w[n]
boxcar(M+1), M = 8
-5 0 50
0.5
1
n
w[n]
triang(M+1), M = 8
-5 0 50
0.5
1
n
w[n]
bartlett(M+1), M = 8
-5 0 50
0.5
1
n
w[n]
hann(M+1), M = 8
-5 0 50
0.5
1
n
w[n]
hanning(M+1), M = 8
-5 0 50
0.5
1
n
w[n]
hamming(M+1), M = 8
-5 0 50
0.5
1
n
w[n]
hann(M+1), M = 8
-5 0 50
0.5
1
n
w[n]
hanning(M+1), M = 8
-5 0 50
0.5
1
n
w[n]
hamming(M+1), M = 8
0 0.5 1 1.5 2 2.5 3-70
-60
-50
-40
-30
-20
-10
0
W
20 lo
g 10|W
(ej W
)|
M = 16
BoxcarTriangular
0 0.5 1 1.5 2 2.5 3-70
-60
-50
-40
-30
-20
-10
0
W
20 lo
g 10|W
(ej W
)|
M = 16
HammingHanning
0 0.5 1 1.5 2 2.5 3
-0.2
0
0.2
0.4
0.6
0.8
1
W
W(ej W
)
M = 16
BoxcarTriangular
0 0.5 1 1.5 2 2.5 3
-0.2
0
0.2
0.4
0.6
0.8
1
W
W(ej W
)
M = 16
HammingHanning
l We are given a desired response hd[n] which is generally noncausal and IIR l Examples are ideal low-pass, bandpass, highpass filtersl May be derived from a continuous-time filter
l Choose a filter duration M+1 for M evenl Larger M entails more complexity/delay, less approximation error e
l Design a length M+1 window function w[n], real and even, to mitigate Gibbs while keeping good approximation to hd[n]
l Calculate the noncausal FIR approximation ha[n]
l Calculate the noncausal windowed FIR approximation hw[n]
l Add delay of M/2 to hw[n] to get the causal FIR filter h[n]
Summary of FIR Design
FIR Realization: Direct Form
l Consists of M delay elements and M+1 multipliersl Can introduce different delays at different freq. components of x[n]l Will discuss more when we cover z transforms
l Efficient implementation using Discrete-Fourier Transform (DFT)
M
[ ]nx
]0[h ]1[h ]2[h ]1[ -Mh ][Mh
++ + +
…
…D D D
[ ]1-nx [ ]2-nx [ ]Mnx -[ ]1+-Mnx[ ]nx
[ ] [ ] [ ]å=
-=M
kknxkhny
0
Main Points
l Sampling and reconstruction bridges analog and digital worlds
l Upsampling and downsampling ease implementation requirements
l Analog and digital communications allows transmission of information signals through the airwaves
l FIR filter design approximates perfect filters with a design tailored to a set of engineering tradeoffs.