Rutgers University ECE 348 - Sampling Aliasing FIR Filtering

Unformatted text preview:

47Lab 4 – Sampling, Aliasing, FIR FilteringThis is a software lab. In your report, please include all Matlab code, numerical results, plots, and yourexplanations of the theoretical questions. The due date is one week from assignment.4.1. Sampling and Aliasing – SinusoidsThe aim of this lab is to demonstrate the effects of aliasing arising from improper sampling. A givenanalog signalx(t) is sampled at a rate fs, the resulting samples x(nT) are then reconstructed by anideal reconstructor into the analog signalxa(t). Improper choice of fswill result in a different signal,xa(t)= x(t), even though the two agree at their sample values, that is, xa(nT)= x(nT). The procedureis illustrated in the following figure:Lab Procedurea. Consider an analog signalx(t) consisting of three sinusoids of frequencies of 1 kHz, 4 kHz, and 6kHz:x(t)= sin(2πt)+2 sin(8πt)+3 sin(12πt)where t is in milliseconds. Show that if this signal is sampled at a rate of fs= 5 kHz, it will bealiased with the following signal, in the sense that their sample values will be the same:xa(t)= 2 sin(2πt)On the same graph, plot the two signals x(t) and xa(t) versus t in the range 0 ≤ t ≤ 2 msec. Tothis plot, add the time samplesx(tn) and verify that x(t) and xa(t) intersect precisely at thesesamples.b. Repeat part (a) withfs= 10 kHz. In this case, determine the signal xa(t) with which x(t) is aliased.Plot bothx(t) and xa(t) on the same graph over the same range 0 ≤ t ≤ 2 msec. Verify again thatthe two signals agree at the sampling instants,xa(nT)= x(nT). See example graphs at the end.4.2. Sampling and Aliasing – Square WaveConsider a periodic pulse wave x(t) with period T0= 1 sec, as shown below. Let p(t) denote one basicperiod ofx(t) defined over the time interval 0 ≤ t ≤ 1:p(t)=⎧⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎩1, if 0.125 <t<0.375−1, if 0.625 <t<0.8750.5, if t = 0.125 or t = 0.375−0.5, if t = 0.625 or t = 0.8750, otherwise(4.1)This periodic signal admits a Fourier series expansion containing only sine terms with odd harmonicsof the basic periodf0= 1/T0= 1 Hz, that is, the frequencies fm= mf0, m = 1, 3, 5,... Hz:x(t)=m=1,3,5,...bmsin(2πmt)= b1sin(2πt)+b3sin(6πt)+b5sin(10πt)+··· (4.2)The Fourier series coefficients are given as follows, form = 1, 3, 5, 7,...4 SAMPLING, ALIASING, FIR FILTERING 48bm=cos(πm/4)− cos(3πm/4)− cos(5πm/4)+ cos(7πm/4)πmThe reason why the signal x(t) was defined to have the values ±0.5 at the discontinuity points is aconsequence of a theorem that states that any finite sum of Fourier series terms will always pass throughthe mid-points of discontinuities.Lab Procedurea. Define the function of Eq. (4.1) in MATLAB using a one-line anonymous function definition of theform:p = @(t) ... % one period of the square waveusing vectorized relational operations, such as, (0.125<t & t<0.375).b. To understand the nature of the approximation of the square wave by the Fourier series sum,truncate the sum to a finite number of terms, that is, withM odd,xM(t)=Mm=1,3,5,...bmsin(2πmt)= b1sin(2πt)+b3sin(6πt)+···+bMsin(2πMt) (4.3)Evaluate and plotx(t) and xM(t) over one period 0 ≤ t ≤ 1, for M = 21 and M = 41.c. The pulse waveformx(t) is now sampled at the rate of fs= 8 Hz and the resulting samples x(nT)are reconstructed by an ideal reconstructor resulting into the aliased analog signal xa(t).The spectrum of the sampled signal consists of the periodic replication of the harmonics ofx(t)at multiples of fs. Because fs/f0= 8 is an even integer, all the odd harmonics that lie outside theNyquist interval,[−4, 4] Hz, will be wrapped onto the odd harmonics that lie inside this interval,that is, onto±1, ±3 Hz. This can be verified by listing a few of the odd harmonics of x(t) and thecorresponding wrapped ones modulofsthat lie within the Nyquist interval:1357911131517192123252729...1 3 -3 -1 1 3 -3 -1 1 3 -3 -1 1 3 -3 ...where the bottom row is obtained by subtracting enough multiples of fs= 8 from each harmonicuntil it is brought to lie within the interval[−4, 4] Hz. This means then that the aliased signal willconsist only of sinusoids of frequenciesf1= 1andf3= 3Hz,xa(t)= A sin(2πt)+B sin(6πt) (4.4)Determine the coefficientsA, B by setting up two equations in the two unknowns A, B by enforcingthe matching equationsxa(nT)= x(nT) at the two sampling instants n = 1, 2.4 SAMPLING, ALIASING, FIR FILTERING 49On the same graph, plot one period of the pulse wavex(t) together with xa(t). Verify that theyagree at the eight sampling time instants that lie within this period. Because of the sharp transitionsof the square wave, you must use a very dense time vector, for example,t = linspace(0,1,4097);Also, if you wish, you may do part (c) and part (d), as special cases of part (e).d. Assume, next, that the pulse waveformx(t) is sampled at the rate of fs= 16 Hz. By consideringhow the out-of band harmonics wrap into the Nyquist interval[−8, 8] Hz, show that now the aliasedsignalxa(t) will have the form:xa(t)= a1sin(2πt)+a2sin(6πt)+a3sin(10πt)+a4sin(14πt)where the coefficients aiare obtained by the condition that the signals x(t) and xa(t) agree at thefirst four sampling instantstn= nT = n/16 Hz, for n = 1, 2, 3, 4. These four conditions can bearranged into a 4×4 matrix equation of the form:⎡⎢⎢⎢⎣∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗⎤⎥⎥⎥⎦⎡⎢⎢⎢⎣a1a2a3a4⎤⎥⎥⎥⎦=⎡⎢⎢⎢⎣∗∗∗∗⎤⎥⎥⎥⎦Determine the numerical values of the starred entries. Then, using MATLAB, solve this matrixequation for the coefficientsai. Once aiare known, the signal xa(t) is completely defined.On the same graph, plot one period of the pulse waveformx(t) together with xa(t). Verify thatthey agree at the 16 sampling time instants that lie within this period.e. The methods of parts (c,d) can be generalized to any sampling ratefssuch that L = fs/f0is aneven integer (so that all the out-of-band odd harmonics will wrap onto the odd harmonics withinthe Nyquist interval). First show that the number of odd harmonics within the positive side of theNyquist interval is:K = floorL +24This means that the aliased signal will be the sum of K terms:xa(t)=Kk=1aksin2π(2k − 1)t(4.5)By matchingxa(t) to x(t),orp(t), at the first K sampling instants n = 1, 2,...,K, set up a linearsystem ofK equations in the K unknowns ak, i.e., with tn= nT,Kk=1aksin2π(2k − 1)tn= p(tn), n= 1, 2,...,K (4.6)and solve it with Matlab. Once you have


View Full Document

Rutgers University ECE 348 - Sampling Aliasing FIR Filtering

Documents in this Course
Load more
Download Sampling Aliasing FIR Filtering
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Sampling Aliasing FIR Filtering and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Sampling Aliasing FIR Filtering 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?