ee 123 discussion section 1 - university of california,...
TRANSCRIPT
EE123DiscussionSection1
Jan.26,2018Li-Hao Yeh
BasedonnotesbyJonTamir,GiuliaFantiandFrankOng
Announcements
• OfficeHours• Miki:Wednesdays4-5pm,Cory506• Nick:Mondays11-12pm,Cory504• Li-Hao:Wednesdays2-3pm,Cory557
• Lab0– dueMondayJan.29• HW1– dueWednesdayJan.31• Questions?
Abouttoday
• Propertiesofdiscrete-timesystems• PropertiesofLTIsystems• Reviewonlinearregression
Discrete-timesystems
1. Memoryless• 𝑦 𝑛 dependsonlyon𝑥[𝑛]
2. Linear• 𝑇 𝑎(𝑥( 𝑛 + 𝑎*𝑥* 𝑛 = 𝑎(𝑇 𝑥( 𝑛 + 𝑎*𝑇 𝑥* 𝑛
3. TimeInvariant• If𝑦( 𝑛 = 𝑇 𝑥 𝑛 and𝑦* 𝑛 = 𝑇 𝑥 𝑛 − 𝑛- = 𝑦( 𝑛 − 𝑛-
4. Causal• 𝑦 𝑛 dependsonlyoncurrentandpastvaluesof𝑥 𝑛
5. BIBOStable• If 𝑥 𝑛 ≤ 𝐵0∀𝑛 then 𝑦 𝑛 ≤ 𝐵3∀𝑛
𝑇{𝑥[𝑛]}𝑦[𝑛]𝑥[𝑛]
WhataboutLTIsystems?
1. Memoryless• 𝑦 𝑛 dependsonlyon𝑥[𝑛]
2. Linear• 𝑇 𝑎(𝑥( 𝑛 + 𝑎*𝑥* 𝑛 = 𝑎(𝑇 𝑥( 𝑛 + 𝑎*𝑇 𝑥* 𝑛
3. TimeInvariant• If𝑦( 𝑛 = 𝑇 𝑥 𝑛 and𝑦* 𝑛 = 𝑇 𝑥 𝑛 − 𝑛- = 𝑦( 𝑛 − 𝑛-
4. Causal• 𝑦 𝑛 dependsonlyoncurrentandpastvaluesof𝑥 𝑛
5. BIBOStable• If 𝑥 𝑛 ≤ 𝐵0∀𝑛 then 𝑦 𝑛 ≤ 𝐵3∀𝑛
𝑇{𝑥[𝑛]}𝑦[𝑛]𝑥[𝑛]
Linear&Time-invariantsystem
CausalityofLTIsystem
𝑇{𝑥[𝑛]}𝑦[𝑛]𝑥[𝑛]
ℎ[𝑛]
h[n]istheDNAofthesystem
Systemoutput y[n] =1X
k=�1h[k]x[n� k]
Causalsystem:yshouldonlydependsonxwithnonnegative delayk
h[n] = 0, n < 0
CausalLTIsystem:
BIBOstabilityofLTIsystem
𝑇{𝑥[𝑛]}𝑦[𝑛]𝑥[𝑛]
ℎ[𝑛]
Systemoutput y[n] =1X
k=�1h[k]x[n� k]
LTIsystemisBIBO
h[n]What’stheconditionfor
|y[n]| =
�����X
k
h[k]x[n� k]
����� By < 1
BIBOstabilityofLTIsystem
𝑇{𝑥[𝑛]}𝑦[𝑛]𝑥[𝑛]
ℎ[𝑛]
Systemoutput y[n] =1X
k=�1h[k]x[n� k]
x[n] B
x
< 1
Bx
X
k
|h[k]| IfX
k
|h[k]| < 1
LTIsystemisBIBO
X
k
|h[k]x[n� k]| =X
k
|h[k]| · |x[n� k]|
BIBOstabilityofLTIsystem
𝑇{𝑥[𝑛]}𝑦[𝑛]𝑥[𝑛]
ℎ[𝑛]
Systemoutput y[n] =1X
k=�1h[k]x[n� k]
IfLTIsystemisBIBOX
k
|h[k]| < 1 ?
BIBOstabilityofLTIsystem
𝑇{𝑥[𝑛]}𝑦[𝑛]𝑥[𝑛]
ℎ[𝑛]
Systemoutput y[n] =1X
k=�1h[k]x[n� k]
X
k
|h[k]| < 1systemBIBO =)
()
systemnotBIBO=)X
k
|h[k]| = 1
BIBOstabilityofLTIsystem
𝑇{𝑥[𝑛]}𝑦[𝑛]𝑥[𝑛]
ℎ[𝑛]
Systemoutput y[n] =1X
k=�1h[k]x[n� k]
Wanttofindxsuchthatyisalwaysnotbounded!!
x[n] =h[�n]
|h[�n]|
y[0] =X
k
h[k]x[�k] =X
k
|h[k]|2
|h[k]| =X
k
|h[k]| = 1
IfLTIsystemisBIBOX
k
|h[k]| < 1
Question1
LetT1andT2betwoseparatesystemsandTbethecascadedsystem:
𝑇( 𝑦[𝑛]𝑥[𝑛] 𝑇*
𝑇
• IfT1isLTIandT2isnotLTI,thenTcannotbeLTIFalseConsiderthesystemT1=0.ThenT=0• IfT1isnotLTIandT2isnotLTI,thenTcannotbeLTIFalseConsiderthesystem𝑇({𝑥} = 𝑥7and𝑇*{𝑥} = 𝑥
89.Then
𝑇 𝑥 = 𝑥
TrueorFalse?
Question2(fromoldexam)
Adiscrete-timesystemHproducesanoutputsignalythatisthesymmetricpartoftheinput:
𝑦 𝑛 = 𝑥 𝑛 + 𝑥 −𝑛
2
Whichofthefollowingaretrue?• ThesystemmustbeLTI• ThesystemcannotbeLTI
Solution2(fromoldexam)
Adiscrete-timesystemHproducesanoutputsignalythatisthesymmetricpartoftheinput:
𝑦 𝑛 = 𝑥 𝑛 + 𝑥 −𝑛
2
Whichofthefollowingaretrue?• ThesystemmustbeLTI• ThesystemcannotbeLTI
Solution2(fromoldexam)
Nottimeinvariant:• For𝑥( 𝑛 = 𝛿 𝑛 ,then𝑦( 𝑛 = 𝛿 𝑛• For𝑥* 𝑛 = 𝛿 𝑛 − 1 ,then𝑦* 𝑛 = = >?( @=[>@(]
*• 𝑦( 0 = 1 but𝑦* 1 = (
*
àNottimeinvariant
(however,thesystemislinear)
Solution3a(fromoldexam)
Foreachofthefollowingsystems,determineifthesystemis(1)linear,(2)causal,(3)time-invariant,and(4)BIBOstable
IndicateYforYes,NforNo,orXforcannotbedetermined
𝑦 𝑛 = cos |𝑛|� 𝑥 𝑛• Linear?• Causal?• Time-invariant?• BIBOStable?
YY
YN
Question3b(fromoldexam)
Foreachofthefollowingsystems,determineifthesystemis(1)linear,(2)causal,(3)time-invariant,and(4)BIBOstable
IndicateYforYes,NforNo,orXforcannotbedetermined
Theresponsetoaninputof𝛿 𝑛 − 1 is (*
>𝑢 𝑛
• Linear?• Causal?• Time-invariant?• BIBOStable?
XX
XX
Solution3b(fromoldexam)
Theresponsetoaninputof𝛿 𝑛 − 1 is (*
>𝑢 𝑛
• Systemwithimpulseresponse:ℎ 𝑛 = (*
>@(𝑢 𝑛 + 1
à Linear.Notcausal.time-invariant.Stable
• Systemthatalwaysoutputs (*
>𝑢 𝑛 , regardlessofinput
à Notlinear.Causal.Nottime-invariant.Stable
• Systemthatoutputs (*
>𝑢 𝑛 whentheinputis𝛿 𝑛 − 1
and∞ otherwise.à Notlinear.Notcausal.Nottime-invariant.Notstable
Linearregressionprimer
Many signal processing problems can be formulatedas a least squares, where we try to find modelparameters that best fit the observed data. We willsee this many, many times
Linearregressionprimer
Example: Linearregression.Supposeweobservefivedatapoints𝑥 𝑘 ,where𝑘 = −2,−1, 0, 1, 2 .Wewanttofitaline𝑥 = 𝑚𝑘 + 𝑏 byminimizingthesquareddistancebetweenthelineandthedatapoints:
HomeworkProblems
Homework Problem 7
Example: Linear regression. We observe 5 data points x [k] fromk = �2,�1, . . . , 1, 2.We want to fit a line x = mk + b by minimizing the squareddistance between the line and the data points
-2 -1 0 1 2 k
x
Frank Ong EE123 Discussion Section 2
Linearregressionprimer
Foreachvalueof𝑘,wehavealinearequationforourmodel:Example,𝑘 = 2:𝑥[2] = 2𝑚 + 𝑏
Andwehaveasquarederrorwithourdata:Example,𝑘 = 2: 𝑥 2 – 𝑏 + 2𝑚 *
Sumofsquarederrors:∑ 𝑥 𝑘 − 𝑚𝑘 + 𝑏�[
*
à Inmatrixform,Error=(*𝐱 − 𝐊𝜷 *
* Error=(*
𝑥?*𝑥?(𝑥-𝑥(𝑥*
−
−2 1−1 1012
111
𝑚𝑏
*
*
Linearregressionprimer
Tofindthebestfitfromaleastsquaressense,minimizethesumofsquarederrors:
minimizea,b
12
𝑥?*𝑥?(𝑥-𝑥(𝑥*
−
−2 1−1 1012
111
𝑚𝑏
*
*
= minimize𝛃
12 𝐱 − 𝐊𝛃
*
*
Linearregressionprimer
Tosolveforbandm,takethederivative(gradient)withrespecttobandtom,andsettozero:
InPython,K = np.array( […] )x = np.array( […])beta = np.linalg.solve(K, x)
minimize𝛃
12 𝐱 − 𝐊𝛃
*
*
𝐊𝐓𝐊𝛃 − 𝐊𝐓𝐱 = 0 ⟹ 𝛃 = 𝐊𝐓𝐊 ?(𝐊𝐓𝐱
Discrete-timeFouriertransform
𝑋 𝑒hi = ∑ 𝑥 𝑛 𝑒?hi>j>k?j – Analysis
x n = (*m ∫ 𝑋 𝑒hi 𝑒hi>𝑑𝜔m
?m – Synthesis
Question4
WhatistheDiscrete-timeFouriertransformofthebelowsignal𝑥[𝑛]?
hint:convolutionoftwosignals,𝑥 𝑛 = 𝑟 𝑛 ∗ 𝑟[𝑛]
𝑥[𝑛]
Solution4
WhatistheDiscrete-timeFouriertransformofthebelowsignal𝑥[𝑛]?
hint:convolutionoftwosignals,𝑥 𝑛 = 𝑟 𝑛 ∗ 𝑟[𝑛]
𝑥[𝑛]
𝑟[𝑛] 𝑟[𝑛]
∗ =
R 𝑒hi ⋅ R 𝑒hi = X ehiFourierspace
Solution4
𝑋 𝑒hi = 𝑅 𝑒hi * =sin 𝜔 32sin 𝜔
2
*
Normalizedmagnituderesponse: