1 Aliasing • In this lab exercise, you will be sampling asinc function, and obse
ID: 1830180 • Letter: 1
Question
1 Aliasing
•In this lab exercise, you will be sampling asinc function, and observing the effect of sampling
rate.
•The function we would like to sample isx(t), defined as
•Create the sampled discrete time signalx1[t] using the command sinc. Type
help sinc
– Use a fundamental frequency f0 of 0.5Hz.
– Use a sampling rate of 50Hz.
– Define the time vector from -10s to 10s.
•Plot both x1[t] and its magnitudespectrum |X(f)| using the commandfft and 512points.
For x1[t], view the signal from-5s to 5s.
•Now create x2[t] by samplingx(t) using a sampling rate of 2.5Hz.
•Also create x3[t] by samplingx(t) using a sampling rate of 0.5Hz.
•Compare x1[t], x2[t], andx3[t].
•Compare X1(f), X2(f), andX3(f).
•How does the sampling rate affect our sampledsignal? What theorem does this comparison
illustrate ? Explain how theexamle illustrates it.
.
Explanation / Answer
First of all we will creat a function which takes the samplingfrequency , time interval in which we need to sample as the inputand outputs sampled signal x[n] and fft X(f) with 512 points. type the below code in a m-file and it should be saved assample_sinc ---------------------------------------------------- function[x_s, X_f] = sample_sinc(fs, a, b) %fs = sampling frequency %a = beginnig of the samplinf interval % b = end of the sampling interval T = 1/fs; f0 = 0.5; t = a:T:b; l = length(t); x_s = sinc(2*pi*f0*t);% it generates the array of sampled values ofsinc in the interval of a to b with a sapling frequency %of fs X_f = fft(x_s,512); --------------------------------------------------------------------------------- Since we created the function to return the sampled and fft , nowwe write code to call the function for different fs type the folowing code in a seperate m-file. ----------------------------------------------------------------------- clear all; close all; a =-10; b=10; ------------------------------------------------------------- fs1 = 50; t1 = a:(1/fs1):b [x1_s, X1_f] = sample_sinc(fs1,a,b);% plot (t1, x1_s); hold on; plot (1:512, abs(X1_f)); %plots |X1(f)| with normalizedfrequency holdoff; -------------------------------------------------------------- fs2=2.5; [x2_s, X2_f] = sample_sinc(fs2,a,b);% t2=a:(1/fs2):b; plot (t2, x2_s); hold on; plot (1:512, abs(X2_f)); %plots |X2(f)| with normalizedfrequency holdoff; ---------------------------------------------------------------- fs3 =0.5; [x3_s, X3_f] = sample_sinc(fs3,a,b);% t3 = a:(1/fs3):b plot (t3, x3_s); hold on; plot (1:512, abs(X3_f)); %plots |X3(f)| with normalizedfrequency holdoff; ---------------------------------------------------------- ------------
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.