solution set for homework #2 on fourier...
TRANSCRIPT
EE313LinearSignals&Systems(Fall2018)
SolutionSetforHomework#2onFourierSeries
By:Mr.HoushangSalimianandProf.BrianL.Evans
1. Prologue:Thisproblemaskstogeneratethesignalinthetimedomainbyusingthesignal’sspectrum.Thespectralandtimerepresentationsgivecomplementaryviewsintothesignal.
Solution:Thespectrumindicatesthatthesignalhasfrequencycomponentsof-175Hz,-50Hz, 0 Hz, 50 Hz and 175 Hz. The strongest frequency component is at 0 Hz because itsmagnitude (11) is the largest. The second strongest frequency components are at -50Hzand50Hz.Theweakestfrequencycomponentsareat-175Hzand175Hz.
Part(a):Wecandirectlyreadoffthespectralcomponentstocreatethetimedomainrepresentationofthesignal
/2 2 (175) /3 2 (50) 0 /3 2 (50) /2 2 (175)
/3 2 (50) /3 2 (50) /2 2 (175) /2 2 (175)
( ) 4 7 11 7 414 14 8 811
2 211 14cos(2 (50) / 3) 8cos(2 (175) / 2)
j j t j j t j t j j t j j t
j j t j j t j j t j j t
x t e e e e e e e e ee e e e e e e e
t t
π π π π π π π π
π π π π π π π π
π π π π
− − − −
− − − −
= + + + +
+ += + +
= + − + −
Part(b):Thesignalx(t)isperiodicwithperiodT,ifx(t+T)=x(t)forallvaluesoft:x(t)=11+14cos(2π(50)t-π/3)+8cos(2π(175)t–π/2)x(t+T)=11+14cos(2π(50)(t+T)-π/3)+8cos(2π(175)(t+T)–π/2=11+14cos(2π(50)t+2π(50)T-π/3)+8cos(2π(175)t+2π(175)T–π/2)
Inorderforx(t+T)=x(t)forallvaluesoft,wecanequatethefirsttermsinx(t+T)andx(t),equatethesecondtermsinx(t+T)andx(t),andequatethethirdtermsinx(t+T)andx(t),andfindvaluesofTthatworkforallthreeterms.
The first terms are already equal to each other (11). The second terms are equal when2π(50)T=2πmwherem isan integer, i.e.whenT is1/50,2/50,3/50,4/50,etc. Thethirdtermsareequalwhen2π(175)T=2πkwherek is an integer; i.e.,whenT is 1/175, 2/175,3/175,4/175,etc.ThecommonvaluesfortheperiodTinsecondsamongallthreetermsare1/25, 2/25, 3/25, 4/25, etc.,whichmeans that the fundamental period is 0.04 s, and thefundamentalfrequencyis25Hz.
Alternately,thefundamentalfrequencycanbefoundfromthespectrumasthegreatestcommondivisor(gcd)of(50,175):f0=gcd(50,175)=25HzandT0=1/f0=1/25=0.04s
Part(c):cos(ϴ)=Re{ejϴ}.FromtheinverseEuler’sformula,cos(ϴ)=½ejϴ+½e-jϴ.Thereforesinusoidsshouldbeshownbybothfrequencies.
Epilog:Sometimes,it’seasiertoansweraquestioninthetimedomain,andsometimes,usingthefrequencydomainiseasier.Inpart(b),itwasmucheasiertofindthefundamentalfrequencyfromthespectrumthanthetime-domainrepresentation.And,sometimes,atime-frequencyrepresentationistherighttoolfortheproblem,aswe’llseeinproblem3.
Fall2018EE313Homework2solution|TheUniversityofTexasatAustin
2. Prologue:Amplitudemodulationisapowerfulidea.Itisusedtotransmitamessagebyshiftingthefrequencycontentinthemessagetoahigherfrequencytomakeiteasiertotransmit.Considerthetransmissionofanaudiosignal30miles(48km),e.g.fromAustin,TX,toSanMarcos,TX.CrankingupthevolumeontheaudiosignalusingthelargestbankofspeakerspossibleinAustinwouldnotmaketheaudiosignalaudibleinSanMarcos.However,wecoulduseamplitudemodulationtoshifttheaudiosignalby1300kHzandtransmititasanelectromagneticwaveovertheair,whichwouldbeusinganAMRadioStationat1300kHz.AreceiverinSanMarcoswouldreceivetheAMtransmissionandshiftthefrequenciesfrom1300kHzto0Hz,whichisknownasdemodulation.Long-rangepropagationispossibleinAMradiobands.Theideaofamplitudemodulationisusedinlightcommunicationsoveropticalfiber(a.k.a.opticalcommunications)aswellasincellularandWi-Ficommunications.Amplitudemodulationcanalsocreateaudioeffects.ThisparticularproblemlooksatamplitudemodulationusedinAMradio,whichaddsalargeDCoffsettothemessagesignalbeforethefrequencycontentisshifted.
Part(a):Themessagesignalis12+7sin(πt–pi/3)whichhasfrequencycomponentsof-0.5Hz,0and0.5Hz.Themodulating(carrier)signaliscos(13πt),whosefrequencyisat6.5Hz.
13 135 /6 5 /6
13 13 5 /6 14 5 /6 12 5 /6 12 5 /6 14
13
( ) [12 7sin( / 3)]cos(13 ) [12 7cos( / 3 / 2)]cos(13 )7[12 ( )]2 2
76 6 [ ]4
(6 6
j t j tj j t j j t
j t j t j j t j j t j j t j j t
j t
x t t t t te ee e e e
e e e e e e e e e e
e e
π ππ π π π
π π π π π π π π π π
π
π π π π π π π−
− −
− − − − −
−
= + − = + − −
+= + +
= + + + + +
= + 13 5 /6 14 5 /6 14 5 /6 12 5 /6 127 7 7 7) ( ) ( )4 4 4 4
7 5 7 5cos(12 ) 12cos(13 ) cos(14 )2 6 2 6
j t j j t j j t j j t j j te e e e e e e e
t t t
π π π π π π π π π
π ππ π π
− − − −+ + + +
= + + + −
A1=7/2=3.5 ω1=12π(rad/s) φ1=5π/6(rad) A2=12 ω2=13π(rad/s) φ2=0(rad)A3=7/2=3.5 ω3=14π(rad/s) φ3=-5π/6(rad)
Part(b):Notethatthemessagesignalhasbeenshiftedtotherightby6.5Hz.Asimilarshiftinfrequencyalsooccurstotheleft,whichmakessensebecauex(t)isreal-valued.
Fall2018EE313Homework2solution|TheUniversityofTexasatAustin
3. Prologue: In a chirp signal, as mentioned in Section 3-8 of Signal Processing First, theprincipalfrequencyincreases(ordecreases)withtime.
Inactivesonarsystems,thetransmitterplaysouta“ping”assound informofachirpandthenreceivessound.Thetimeelapsedbetweenthetransmissionandreceptionofthechirpindicates theroundtrip timeexperiencedby thesignalafterbouncingoffanobject in thewater and returning to the receiver. By receiving sounds in different directions usingmultiplemicrophones,thesonarcanbuildamapoftheobjectsinthewater.
This kind of ranging approach can also be used for positioning and navigation. Bats usechirps for echolocation. Pipestrelle bats uses chirps that sweep down from 70 to 45 kHz.https://www.wildlife-sound.org/resources/equipment/2-uncategorised/233-recordings-of-ultrasonic-vocalisations-of-bats
Whenonemeasures the responseof a system todifferent frequencies, a time-consumingapproachistoinputasinglesinusoid,measuretheoutput,andrepeatusingmanydifferentfrequencies.Instead,inputtingachirpcanallowthemeasurementtoperformedinonetake.
4G cellular communication systemsperiodically send a Zadoff-Chu chirp sequence to helpmeasurethedistortionintheelectromagneticpropagationfromtransmittertoreceiver.
Part(a):MATLABcodetogeneratethechirpsignal:
Partb:ThechirpsignalcanbeplayedasanaudiosignalinMATLAB:
Thechirplinearlysweepsfrequenciesfrom20to4220Hz,andsoundslikeanoteincreasingin“pitch”overtime.Thesweepspans8octavesofAnotesonaWesternscale:27.5,55,110,220,440,880,1760,3520Hz.Seehttps://en.wikipedia.org/wiki/Piano_key_frequencies.
Part(c):Wecanvisualizethevariationoftheprincipalfrequencyovertimebyusingatime-frequencyrepresentation.Thetime-frequencyrepresentationbelowiscalledaspectrogram.
The spectrogram for the chirp signal (next page) shows the principal frequency changingover time with a linear slope. At the beginning, the principal frequency is at 20 Hz andincreases linearly to 4220Hz. Theprincipal frequencyhas thehighestmagnitude at everyinstantoftimethroughouttheentiredurationofthechirpsignal,whichisshowninyellow.
Asdescribedonlectureslides4-8and4-9,aspectrogramtakesthefirstNwinsamplesofthesignal,weightsthevalues(usingarectangularpulsebydefault),computestheFourierseriescoefficients, and plots the magnitude of the Fourier series coefficients vertically. ThespectrogramthenshiftsthetimesignaltotherightandrepeatsthepreviousstepsusingablockofthenextNwinsamples.Thefrequencyresolutionofthespectrogramisfs/Nwin.
time = 10; % length of time in seconds f0 = 20; % specify starting principal frequency fstep = 420; % specify frequency slope fs = 44100; % sampling rate Ts = 1/fs; % sampling time: time interval between samples t = 0 : Ts : time; % create a time vector theta = 2*pi*(f0+0.5*fstep*t).*t; y = cos(theta); % create chirp waveform
sound(y, fs); % play back chirp signal
Fall2018EE313Homework2solution|TheUniversityofTexasatAustin
Inthecodebelow,aHammingwindowisusedtoweightthevaluesineachblockofsamples.
Althoughnotasked,wecanincreasethefrequencyresolutionbyincreasingtheblocksize:
figure; spectrogram(y, hamming(256), 128, 256, fs, 'yaxis') ylim([0,5]); title('Spectrogram of the signal'); ylabel('Frequency(kHz)'); xlabel('Time(s)');
figure; spectrogram(y, hamming(1024), 512, 1024, fs, 'yaxis') ylim([0,5]); title('Spectrogram of the signal'); ylabel('Frequency(kHz)'); xlabel('Time(s)');
Fall2018EE313Homework2solution|TheUniversityofTexasatAustin
4. Prologue:Thisproblemexploresvariousaudioeffectsbyapplyingnonlinearoperationstoasinusoidalsignal.Italsoexploreswhathappenstothefrequencycomponentofasinusoidalsignalduetononlinearoperations.Thisisacommonapproachinanalyzinghowanonlinearsystem(e.g.adiodeortransistor)respondstodifferentfrequencies.Amongthenonlinearoperations,parts(a),(b)and(c)canbeusedinamplitudedemodulation(seethePrologueforProblem2).Thenonlinearoperationinpart(d)isatypeoffrequencymodulation.
Solution:MATLABcodeforgeneratingandplayingx(t)andoutputsignalsforparts(a)-(d):
x(t)onlycontainsthefrequencies±440Hz,andthespectrogramshowsthis.
f0 = 440; fs = 8000; Ts = 1/fs; t = 0:Ts:5; x = cos(2*pi*f0*t); y_a = abs(x); y_b = x.^2; y_c = x.^4; y_d = cos(pi*x); figure(1) spectrogram(x, hamming(256), 128, 256, fs, 'yaxis') sound(x,fs) pause(8); figure(2) spectrogram(y_a, hamming(256), 128, 256, fs, 'yaxis') soundsc(y_a,fs) pause(8); figure(3) spectrogram(y_b, hamming(256), 128, 256, fs, 'yaxis') soundsc(y_b,fs) pause(8); figure(4) spectrogram(y_c, hamming(256), 128, 256, fs, 'yaxis') soundsc(y_c,fs) pause(8); figure(5) spectrogram(y_d, hamming(256), 128, 256, fs, 'yaxis') soundsc(y_d,fs)
Fall2018EE313Homework2solution|TheUniversityofTexasatAustin
Part(a):Thefundamentalperiodofy(t)isdifferentfromfundamentalperiodofx(t).Inordertobeperiodicy(t)=y(t+T0)andT0isthefundamentalperiodwhereT0=1/880(s)
0
2
( )kj
Tk
ky t a e
π∞
=−∞
= ∑
00
0 0
0
2 22
0 002
1 1( ) ( )
Tk kT j j
T Tk
Tt
a y t e dt y t e dtT T
π π− −
= −
= =∫ ∫
11760101760
880 2880 cos(2 (440)) (sin( ) sin( ))2 (440) 2 2
a dt π ππ
π π−= = − − =∫
And
0
0
0
1117602
2 2 (880) 2 (880)17601
10 176017602
1 2 (440) 2 (440) 2 (880 440) 2 (8802 (880)1760
11760
1 ( ) 880 cos(2 (440) ) 880 cos(2 (440) )
880 8802
T
j kf t j k t j k tk
T
j t j t j k t j kj k t
a y t e dt t e dt t e dtT
e e e ee dt
π π π
π π π ππ
π π− − −−
−−
− − − −−
−
= = = =
+ += =
∫ ∫ ∫
∫1 440)
17601
1760
2 (0.5 0.25) 2 (0.5 0.25) 2 (0.5 0.25) 2 (0.5 0.25)
2
880 1 1( ) ( )2 2 (880 440) 2 (880 440)
1 1 1 1 2cos(2 (2 1) 2 (2 1) 2 (2 1) 2 (2 1)
t
j k j k j k j k
j k j k
dt
e e e ej k j k
e ek k k k
π π π π
π π
π π
ππ π π π
+
−
− − − − + +
−
⎡ ⎤= − − − −⎢ ⎥− +⎣ ⎦
⎡ ⎤ ⎡ ⎤= − + + − + =⎢ ⎥ ⎢ ⎥− + − +⎣ ⎦ ⎣ ⎦
∫
2
)(1 4 )
kkπ −
So,y(t)containsaninfinitenumberofevenharmonicsof440Hz,whichcorrespondtofrequenciesof±880kwherekisanintegervalue.Asexpected,wecanhearahigherfrequencysound.Thesoundfeelsashighernumberoffrequenciesarepresent(less‘thin’thanapurecosine).TheSamplingTheoremsaystochoosethesamplingratesothatfs>2fmax.Afterdividingbothsidesby2,fmax<½fs.Samplingat8kHzwillonlycaptureharmonicfrequenciesbelow4kHz.
Fall2018EE313Homework2solution|TheUniversityofTexasatAustin
Part(b):
𝑦 𝑡 = 𝑐𝑜𝑠!(2𝜋440𝑡)
𝑦 𝑡 =12+12cos (2𝜋880𝑡)
(Usingthetrig.identitycos(2θ)=2cos2(θ)-1)
y(t)contains0Hzand±880Hz,whichareevenharmonicsof440Hzuptothe2ndharmonic.
Alternatively,
𝑦 𝑡 = cos!(2𝜋440𝑡)
𝑦 𝑡 = (𝑒!!!!!"! + 𝑒!!!!!!"!)!/4
=𝑒!!!!!"! + 𝑒!!!!!!"! + 2
4=12+cos 2𝜋880𝑡
2
(Usingthebinomialexpansionfor(a+b)2=a2+b2+2ab)
Itsounds‘thin’,whichisbecausejustonefrequencyispresentinthewaveform,whileinparta,higherfrequenciescouldbeheard.
Part(c):
y(t) = x4 (t) = cos4(2π f0t) = (e j2π f0t + e− j2π f0t
2)4 = e
j8π f0t + e− j8π f0t + 4e j4π f0t + 4e− j4π f0t +616
= 0.375+0.5cos(4π f0t)+0.125cos(8π f0t) = 0.375+0.5cos(2π (880)t)+0.125cos(2π (1760)t)
(Usingthebinomialexpansionfor(a+b)4=a4+b4+4a3b+4ab3+6a2b2)
So,y(t)containsthefrequencies0Hz,±880Hzand±1760Hz,whicharetheevenharmonicsof440Hzuptothe4thharmonic.
Thissoundsasifithasafrequencybetweenthesignalsinparts(a)&(b).Thesoundismore‘thin’thanpart(a),whileitisnotpureasaudioinpartb,andtheotherfrequency(±1760Hz)canbeheard.
Fall2018EE313Homework2solution|TheUniversityofTexasatAustin
Part(d):UsingTaylorseriesexpansion:
2 42
0
( 1)cos( ) 1(2 )! 2! 4!
nn
n
x xx xn
∞
=
−= = − + −∑ L
2 4 6 80 0 0 0
0(cos(2 )) (cos(2 )) (cos(2 )) (cos(2 ))cos( cos(2 )) 1
2! 4! 6! 8!f t f t f t f tf t π π π π
π π = − + − + −L
Asshownintheaboveformula,y(t)includes(cos(πcos(2πf0t))2,andasshowninpart(b)and(c),y(t)=cosn(2pif0t)willhaveoddharmonicsuptothenthharmonicifnisodd,andevenharmonicsuptothenthharmonicifnisevenincludingazero-frequencycomponent.
Comparedtoparts(b)and(c),theaudiosignalhasadditionalharmonics.