Excerpt
EE 556
1.
The following continuous-time signal is sampled in the time interval of t = 0 t < 40 *10^-3
sec and = 25000 Hz
x(t) = sin(2 ×1000t) + 3cos(2 × 2000t) - 5sin(2 ×625t) + 2cos(2 ×1625t) .
Find the DFT of the resultant discrete-time signal and plot its magnitude versus the "actual"
frequency. Explain what you see in the graph. (You can use fft command in MATLAB to find
the DFT of the signal)
2.
Let's repeat the above procedure in the time interval of t = 0 t < 38 * 10 ^-3 Sec. Why the
DFT magnitudes plot is different compared to the one obtained in the previous question?
Explain. (This effect is called: spectral leakage!)
Code:
a.
close
all
;
clear
all
;
tmin = 0;
tmax = 40 * 10^(-3);
dt1 = 1/25000;
t1 = tmin:dt1:tmax;
x1 = sin(2000*pi*t1)+ 3*cos(4000*pi*t1)- 5*sin(1250*pi*t1)+
2*cos(3250*pi*t1);
subplot
211
;
plot(t1,x1);
title(
'Sinusoid Plot'
);
xlabel(
'Time Period'
);
ylabel(
'Amplitude'
);
FFT=fft(x1);
subplot
212
;
plot(-5250:10.5:5250,(abs(FFT)));
title(
'FFT Plot'
);
xlabel(
'Actual Frequency'
);
ylabel(
'Amplitude'
);
Output:
EE 556
b.
code:
close
all
;
clear
all
;
tmin = 0;
tmax = 38 * 10^(-3);
dt1 = 1/25000;
t1 = tmin:dt1:tmax;
x1 = sin(2000*pi*t1)+ 3*cos(4000*pi*t1)- 5*sin(1250*pi*t1)+
2*cos(3250*pi*t1);
subplot
211
;
plot(t1,x1);
title(
'Sinusoid Plot'
);
xlabel(
'Time Period'
);
ylabel(
'Amplitude'
);
FFT=fft(x1);
subplot
212
;
plot(-5250:11.05:5250,(abs(FFT)));
title(
'FFT Plot'
);
xlabel(
'Actual Frequency'
);
ylabel(
'Amplitude'
);
Output:
Suppose you want to analyze a block of samples that represents a simple sine wave. You have your
block of samples x[n] and you apply the FFT to obtain the spectrum X[k] which is the spectrum of the
infinite series that you would get if you periodically repeat x[n]. Problems arise when the block that
you analyze does not contain an integer number of periods, causing discontinuities when you would
repeat the blocks.
What you actually analyze is a windowed version of the real infinite periodic signal, i.e. you take the
fft of w[n].x[n]. Not explicitly applying a window function w[n] means that a rectangular window is
used, i.e. w[n] = 1 for n = 1 to N and zero otherwise. In the frequency domain this means that the
true spectrum is convolved with a sinc function which causes the leakage
EE 556
3
. Consider the following finite length signals:
x1 = [1 2 1 -2 6 0 1 -1 2];
x2 = [1 -2 4 7 1];
They both start at n = 0 .
a. Find the convolution of the signals using the "conv" function in MATLAB.
b. Find the convolution of the signals using the DFT and IDFT method. Employ
16-point DFT and IDFT.
c. Show that results of part (a) and part (b) are identical (ignore the padded zeros at
the end of the signal that you obtained in part (b)).
a.
Code:
close
all
;
clear
all
;
x1 = [1 2 1 -2 6 0 1 -1 2];
x2 = [1 -2 4 7 1];
c = conv(x1,x2);
figure,stem(c);
title(
'Convolution Using CONV Function'
);
xlabel(
'Sample Number'
);
ylabel(
'Amplitude'
);
Output:
Excerpt out of 6 pages
- Quote paper
- Pragnesh Patel (Author), 2014, Tasks for Digital Signal Processing with Solution, Munich, GRIN Verlag, https://www.grin.com/document/284206
Publish now - it's free
Comments