DSP Lab Record
DSP Lab Record
Lab Assignment 1
Code:
Output:
2. Generation of complex exponential sequence.
Code:
Output:
3. Illustration of Signal Generation
Code:
Output:
4. Illustration of Convolution
Code:
Output:
Output:
Output:
Output:
Lab Assignment 2
1.
a. Write a Matlab program to perform 16 point DFT of the
discrete time sequence x(n)={⅓, ⅓, ⅓} and sketch the
magnitude and phase spectrum.
Code:
Output:
b. Write a Matlab program to perform 8 point DFT of the
discrete time sequence x(n)={2,1,2,1,1,2,1,2} and sketch
the magnitude and phase spectrum.
Code:
Output:
Code:
Output:
Lab Assignment 3
Code:
Output:
2. Plot the auto-correlation of the sequence x[n]= [1, 3 ,-2 ,
1 ,2 ,-1 ,4 ,4 ,2].By adding a random noise d[n] to x[n]
compute and plot auto-correlation of the noise corrupted
sequence.
Code:
1. Auto-correlation
Output:
1. Auto-correlation
2. Auto-correlation with noise
3. Write a Matlab code to determine the period of the sinusoidal
sequence x[n]= cos(0.25πn), 0 ≤ n ≤ 95 corrupted by an
additive uniformly distributed random noise of amplitude in
the range [-0.5,0.5].
Code:
Output:
Lab Assignment 4
1. Consider a pure sinusoidal signal of frequency fx=10Hz and to
represent in computer memory, the signal is observed for 1
second and sampled at frequency Fs=100Hz. Now, there will be
100 samples in the buffer and the buffer will contain integral
number of waveform cycles (10 cycles in this case). The signal
samples are analyzed using N-point DFT. Two cases are
considered here for investigation : 1) The FFT size is same as the
length of the signal samples, i.e, N=100 and 2) FFT size set to
next power of 2 that fits the signal samples i.e, N=128.
Code:
Output:
2. In the first example, the signal wave was observed for 1 second
duration and that fetched whole 10 cycles in the signal buffer.
Now, reduce the observation time to 0.91 second and re-run the
same code, results below. In this case, the signal buffer will
have 9.1 cycles of the sine wave, which is not a whole number.
For case 1, the frequency resolution is 1 Hz and the FFT plot has
registered a distinct peak at 10 Hz. Careful investigation of the
plot will reveal very low spectral leakage even in case 1
(observe the non-zero amplitude values for the rest of the
bins).This is primarily due to the change in the observation
interval leading to non-integral number of cycles within the
observed window. The spectral leakage in case 2, when N=128,
is predominantly due to mismatch in the frequency resolution.
From these two examples we can say that
1) The mismatch between the tone of the signal and the chosen
frequency resolution (result of sampling frequency and the FFT
length) leads to spectral leakage (experiment 1).
2) Time-limiting an observation (at inappropriate times), may lead
to spectral leakage (example2).
3) Hence, the spectral leakage from a larger signal component, if
present, may significantly overshadow other smaller signals
making them difficult to identify or detect.
Code:
Output:
Lab Assignment 5:
1. Suppose the analog signal xa(t) is sampled at 4 Hz for 2
seconds, resulting in the 8 samples, x(n) = xa(nTs) = [−1,
2, 1, 2, 1, 1, −1, −1] for 0 ≤n ≤7. Using Matlab, plot
the spectrum Xf(ω) = DTFT {x(n)} versus physical frequency
in Hz with the DC component in the center.
Code:
Output:
2. Calculate Discrete Fourier Transform of a signal using MATLAB and then
analyze the effect of noise on the signal and its Fourier Transform.
Code:
Output:
Lab Assignment 6
Code:
Output:
Code:
Output:
Lab Assignment 7
1. Design a Butterworth IIR Filter using Impulse
Invariance Transformation by taking T=1sec and
0.707 ≤ |H(e jω)| ≤ 1.0; for 0 ≤ ω ≤ 0.3π |H(e
jω)≤0.2; for 0.75π≤ω≤ω
Code:
Output:
2. Design a Butterworth IIR Filter using Bilinear
Transformation method by taking T=1sec and 0.707 ≤
|H(e jω)| ≤ 1.0; for 0 ≤ ω ≤ 0.3π |H(e jω)≤0.2; for
0.75π≤ω≤ω
Code:
Output: