

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


E E 2 7 5 (September 14, 2008)
Digital Signal Processing & Filtering Fall Semester 2008
[2.1] X= rand(N,1) generates N samples of a random variable X that are uniformly distributed on [0,1]. (Alternatively, you can look upon the sequence generated as a realization of a random process with in- dividual samples as random variables). Using hist(X) gives you a histogram, which is a non-normalised approximation to the pdf, which shows you how good a uniform pdf you have. In problem 2.1, the signal is the same for a number of additions of noise vectors. The averaging then effectively operates on the ensemble of noise, that is, the 50 realizations, thereby smoothing the noise. The signal, which is āfixedā is not affected. Note that you can also time averaging as in problem 2.4. Other observations: For the noise vector x, autocorrelation Rx(m) (the time-averaging one) is defined as Rx(m) =
n
x(n)x(m + n)
The MATLAB function y = xcorr(x, x) accomplishes that. Better yet, use the covariance function y = xcov(x) which is defined as
Cx(m) =
n
(x(n) ā ĀÆx)(x(n + m) ā ĀÆx)
where ĀÆx is the mean value of x. Here you see more of a ādelta-functionā that implies decorelation of neighboring samples. So, using y=xcov(x), plot(y) gives a plot of the covariance of x and shows you how well the noise is decorrelated. Note that the white part of white noise refers to the fact that since all samples are ideally uncorrelated i.e. Rx(m) =
m x(n)x(n^ +^ m) =^ Ī“(m). The Power Spectral density^ Sx(e jĻ (^) ), which is the DFT of Rx(m), will be 1 for all frequencies Ļ ā Ļ. Hence the term white noise. Note also that the pdf of white noise may be Uniform, Gaussian, Poisson or any other distribution. The whiteness and distribution are independent. Once you have white noise i.e. a flat spectrum, you can apply that noise to a filter, say a low pass filter. The output power spectral density Sy (Ļ) will no longer be flat. You now have colored noise.
[2.2] Generating a complex exponential sequence; plotting the real and imaginary parts. Using .01 for the real exponent,. 1 Ļ for the imaginary exponent, amplitude of 1 and signal length of 100 we get signals as in Figures 1(a) and 1(b). That is, exponentially decreasing sinusoids.
[2.3] Generating a real exponential sequence, using real arguments.
[2.4] A MA filter is an averaging filter where the averaged portion of the input moves. That is, for example y[n] = 13 (x[n] + x[n ā 1] + x[n ā 2]) gives a 3-point MA filter. You have a M-point MA filter. This type of averaging is ātime-averagingā (of a single time series) as opposed to averaging over an ensemble as in problem 2.1. We observe that for small M (3) the filtered signal still shows noise. For large M (20) the filtered signal is quite smooth, but there is a large delay. This of course can be problematic in real-time applications. Additionally, for a more complex signal, the large M filter will smooth out signal features which may not be desirable.
ā3 0 10 20 30 40 50 60 70 80 90 100
ā
ā
0
1
2
3
Time index n
Amplitude
Real part
ā3 0 10 20 30 40 50 60 70 80 90 100
ā
ā
0
1
2
3
Time index n
Amplitude
Imaginary part
Figure 1: (a) Real part, (b) Imaginary part.
[2.5] We shall examine the spectral characteristics of filters and related matters later on when we get to frequency domain analysis. The median filter works well with so-called āsalt and pepperā noise or so- called āimpulse noiseā. (That is noise which consists of outliers, that is, signal values that are extreme or out of characteristic with other signal data.) It does not work well with white noise.
[2.7] In this program cross correlation is illustrated using the convolution operation with one flipped signal, and then finding the output for various ālagsā or āshiftsā. You can also use the function āxcorr(x,y)ā which will give you the same answer, but for all possible shifts.
[2.8] For y[n] = s[n]+d[n] where s[n] is the signal and d[n] is the noise, consider the statistical autocorrelation function (using E for the expectation operator) which is defined as,
Ry (m) ā” E{y[n]y[n + m]}
This equals, = E{s[n]s[n + m]} + E{d[n]d[n + m]} = Rs(m) + Rd(m) assuming that the signal and noise are uncorrelated i.e. E{s[n]d[n + m]} = 0, which often is the case. Hence the result is the sum of the two autocorrelations. In problem 2.8, the statistical (ensemble) autocorrelations are implemented as time averages. The correlation itself, as we saw earlier, is being implemented using convolution (with a flipped version of one of the signals). The autocorrelation of a sine will give a sine. Autocorrelation of noise will, ideally, give a delta-function.