Lab4 DSP
Lab4 DSP
Student Name:
Reg. No. :
Date :
Signature :
Objectives:
Ref: Ingle and Proakis, Digital Signal Processing using Matlab, p.60 Page 1
Before you perform step2, check the presence of the function dtft.m in the current folder.
Procedure:
Step 1: A SINC analog signal in duration [-10ms, 10ms] is presented in time and frequency domains
% Analog signal
syms t x f
T = 1e-3; % 1ms
x = sinc(1/T * t)
X(w) = fourier(x);
X(f) = subs(X,'w','2*pi*f');
subplot(2,1,1),ezplot(x,[-10*T,10*T]),grid on,axis([-10*T,10*T,-0.3,1]);
title('Time Domain'),xlabel('Time in sec');
subplot(2,1,2),ezplot(abs(X),[-2e3,2e3]),grid on,title('Amplitude Spectrum');
xlabel('Frequency Domain'),xlabel('Frequency in Hz');
After you execute the above script, an analog signal, x, is created with its corresponding CTFT, X.
Q1) Draw the SINC signal, showing the time duration of the main lobe and the maximum frequency of the
signal.
Ref: Ingle and Proakis, Digital Signal Processing using Matlab, p.60 Page 2
Q2) What is the Nyquist rate for the SINC signal?
Step2: The effects of sampling of analog signal in the frequency domain: (15 mins)
Now, let’s try to sample the analog signal, x, with different sampling frequency, Fs, and check the spectrum of
the discrete signal resulted from the sampling process.
Fs = 750 %Hz
n_neg = (-10e-3*Fs:-1);
n_pos = (1:10e-3*Fs);
n = [n_neg 0 n_pos];
x_instant = [subs(x,n_neg/Fs) 1 subs(x,n_pos/Fs)];
omega = linspace(-6*pi,6*pi,501);
X_DTFT = dtft(x_instant,n,omega);
subplot(3,1,1);stem(n/Fs,x_instant), hold on;
ezplot(x,[-10e-3,10e-3]),axis([-10e-3,10e-3,-0.3,1]);
subplot(3,1,2), plot(omega/(2*pi),abs(X_DTFT)); % normalized Frequency axis f
axis([-3,3,0,6]), grid on;
subplot(3,1,3), plot(omega/(2*pi),abs(X_DTFT)); % normalized axis f zoomed
axis([-0.5,0.5,0,6]), grid on;
Try sample the analog signal with 5000 Hz, 2000 Hz, 1000 Hz, 750 Hz, and check the spectrum.
Sampling FREQ, Fs Maximum analog Maximum digital Simulated maximum Aliasing effect?
frequency, Fo frequency, fo digital frequency, fo
5000
2000
1000
750
Conclusion:
Ref: Ingle and Proakis, Digital Signal Processing using Matlab, p.60 Page 3