Lab3
Lab3
Lab3
By:Hitham Jleed
http://www.site.uottawa.ca/~hjlee103/
© H. Jleed: 2018 ~
Assignment 03
© H. Jleed: 2018 ~
Sampling
(1) Time domain representation of sampling and aliasing
Sampling Process
Among the frequencies, there is a unique one that lies within the Nyquist
interval. It is obtained by reducing the original f modulo-fs, that is, adding to or
subtracting from f enough multiples of fs until it lies within the symmetric
Nyquist interval [−fs/2, fs/2].
© H. Jleed: 2018 ~
Aliasing
Fa=f mod(fs)
© H. Jleed: 2018 ~
Sinusoid Signal
f
xn = sin( 2 0 n + ) fs = 8 kHz By varying the value f0
fs
When f0=300 Hz
Can you predict in advance if the frequency will increase or decrease ? Why/How ?
© H. Jleed: 2018 ~
(2) Frequency domain representation of sampling and
aliasing, A/D and D/A conversions
function freqmagplot(x,dt)
x(t ) = cos(2f 0t ) cos( 2f 0 n t ) L=length(x);
Nfft=round(2.^round(log2(5*L)));
X=fft(x,Nfft);
n=0,1,2,... f0 =2kHz f=((1/dt)/Nfft)*(0:1:Nfft/2-1);
plot(f,abs(X(1:Nfft/2)));
t =1/80000 title('Magnitude of Fourier Transform’);
xlabel('Frequency'),grid;
end
© H. Jleed: 2018 ~
Simulate the A/D conversion
- we need to keep one sample in every 10 samples.
Plot the resulting discrete time signal and its discrete time Fourier transform
(freqmagplot can be used, but with the appropriate value for dt !).
© H. Jleed: 2018 ~
Simulate the D/A conversion
Two Steps: (1) convert it into an analog pulse signal. To simulate the analog pulse signal, 9 zeros are
added between each sample of the discrete time signal. (2). filter (interpolate) the signal
© H. Jleed: 2018 ~
Filtering
[b, a] = cheby2(9, 60, fs*1/80000);
y = filter(b,a,x);
© H. Jleed: 2018 ~
The effect of aliasing
When does aliasing occur? What is the effect of aliasing on the output signal of the
D/A converter (found in i) ) ?
© H. Jleed: 2018 ~
Complete all the assignment. Submit it the Brightspace
© H. Jleed: 2018 ~