[go: up one dir, main page]

0% found this document useful (0 votes)
44 views13 pages

Project Report 3 v2

Project Report writing

Uploaded by

aini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views13 pages

Project Report 3 v2

Project Report writing

Uploaded by

aini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

ENGIN 322: Probability and Random Processes

Engineering Department
University of Massachusetts, Boston

Instructor: Dr. Michael Rahaim

Project Report
Project #3: Correlation Functions and Spectral Density

Name: _________________________________________
Student ID: _____________________________________
Date: __________________________________________

I pledge to uphold the governing principles of the Code of Student Conduct of the University of
Massachusetts Boston. I will refrain from any form of academic dishonesty or deception, cheating, and
plagiarism. I pledge that all the work submitted here is my own, and that I have clearly acknowledged
and referenced other people’s work. I am aware that it is my responsibility to turn in other students
who have committed an act of academic dishonesty; and if I do not, then I am in violation of the Code.
I will report to formal proceedings if summoned.

Signature: _________________________________________________________________________
Contents
1. Project Overview ............................................................................................................................. 1
2. Expected Outcomes ........................................................................................................................ 1
3. Analysis Method.............................................................................................................................. 1
4. Results and Observations................................................................................................................ 2
4.1 Experimental Results..................................................................................................................... 2
5. Summary ......................................................................................................................................... 8
6. Appendices (MATLAB Code for Part I, Part II) ................................................................................. 8
1. Project Overview
The aim of this project is to simulate and study in detail the binary communication process. In the
first part of the project the binary processes are analyzed by computing the autocorrelation function
(ACF) and power spectral density of a transmitted simulated signal without any noise. From the ACF
plot of the simulated signal (shown in Fig. 1) it is evident that the ACF is highest at zero lag and fall to
zero for different points of the signal. The power spectral density is also computed for this transmitted
signal which shows that it is a lowpass signal and most of the power of the signal is in low frequencies.
In the 2nd part of this project, a received binary process contaminated by White Gaussian Noise (WGN)
is analyzed using the same tools of ACF and PSD. The project provides a practical example for studying
the correlation between two random variables. The received signal is a delayed noisy version of the
transmitted signal. Using cross correlation, the start of the preamble is determined. The project
provides a practical example for studying the autocorrelation, cross-correlation and Power Spectral
Density of clean and noisy signals.
In the third part of the project examples from real-world related to this project are discussed. .

2. Expected Outcomes
This project exhibits how the correlation and PSD can be utilized to check the randomness of a process.
It also examined the role of power spectral density in finding the frequency contents and
corresponding spectra of the Random Process. The expected outcome is that autocorrelation of
randomly selected points from the binary process is zero. Another outcome of the project is to observe
the theoretical and practical (simulated) results of the ACF and PSD..

3. Analysis Method
In this project first in Part I, we wrote the MATLAB code for simulating a binary process. The binary
process has 50,000 symbols with symbol rate of 1kHz (i.e., 𝑡𝑎 = 0.001) and sample rate of
100kHz (i.e., 100 samples or repetitions for every symbol). The ACF of this binary process is
computed using the xcorr function of the MATLAB. it is evident that when the lags become
equal to ta=0.001, the ACF falls to zero. The max value of the correlation is A2 which is same
as the theoretical value. The PSD of this signal is then computed which indicates that most of
the power of the signal is in the lower frequencies below 1000Hz.

1
4. Results and Observations
4.1 Experimental Results
4.1.1 Part I
In this project in Part I, we wrote the MATLAB code for simulating a binary process. The binary
process has 50,000 symbols with symbol rate of 1kHz (i.e., 𝑡𝑎 = 0.001) and sample rate of
100kHz (i.e., 100 samples or repetitions for every symbol). A zoomed version of this process
is shown in Figure 1.

Figure. 1 Simulated Binary Process

The ACF of this binary process is computed using the xcorr function of the MATLAB. The ACF
is shown in Figure 2.

Figure. 2 the ACF of the Binary process shown in Figure. 1


The zoomed version of the ACF is shown in Figure 3.

2
Figure. 3 Zoomed plot of the Auto-correlation function
From figure 3, it is evident that when the lags become equal to ta=0.001, the ACF falls to zero.
The max value of the correlation is A2 which is same as the theoretical value. The PSD of Using
this signal, generate the autocorrelation function and power spectral density of the process
using Matlab’s xcorr() and periodogram() functions. The Linear PSD using FFT of the ACF is
shown in the Figure 4.

Figure 4 PSD of the Binary Process

The results show that most of the power of the Binary Process is in the lower frequencies below 1000
Hz.

Question 1: Relate your observations of the simulated signal to the theoretical


autocorrelation function and spectral density function for this process. Use the ACF
determined in class (and in section 6-2 of the textbook) in order to evaluate the spectral
density for this function: 𝑆x (𝑓) = ℱ{𝑅x (𝜏)}.

3
Answer: From the values of the ACF, for the binary process, as shown in Figures 3 and 4, it
can be seen that it matches the theoretical findings. The matlab code for this section is given
in appendices.

Question 2: : Use the equation for 𝑆x(𝑓) determined in question 1 to determine the
approximate frequency where 90% of the average power is below. Rather than integrating,
you can approximate this by summing the values from the equation using a resolution of 1Hz.
Compare your result to the simulated spectral density in Matlab?
Answer: To find the frequency where the 90% power is below we first computed the PSD
and then create cumulative power spectral using the cumsum() function. The cumulative

power is then normalized. Plot it versus frequency as shown in Figure 5, and look for the 0.9
level. From the figure, it can be seen from the plot that 90% power lies approximately below the
frequency of 858.24 Hz. This frequency is also determined using the MATLAB find function. The
code is mentioned in the appendices.

Figure 5: Cumulative PSD of the Binary Process

Part II Analysis of the received noisy binary process


a) In this part II, the received noisy signal is loaded from the given .mat file namely
‘part2_2022.mat’. The received signal is first cross correlated with the preamble. The Cross
correlation is shown in Figure. 6.

4
Figure. 6 Cross-Correlation between the received signal and the preamble.

it is noted that the peak of the correlation is located at 1464. It means after this the first time the
preamble is occurred in the received signal. The matlab code for this computations is given in
appendices part II.
b) A MATLAB function with name Preamble_Loc is written, which returns the possible starting
point of the preamble in the given array. The code is given in the appendix part II.
Part II Question No. 3: When looking for the preamble, is it preferable to compare the
observed signal with the preamble or with the preamble repeated multiple times? Why?
Answer: The purpose of the CCF is to check the similarity between the two input random
process. As we need to research for a similarity of the preamble in the received signal we
can correlate the permeable with the signal which will give peaks in the CCF when there is
an occurrence of preamble. We want to compare the signal with preamble then we can take
replicas of the preamble repeatedly then we can have multiple peaks in the CCF because
whenever the preamble in the signal match with the replicas it will give a peak. the value of
the max peak will also be greater. For example in Figure 7, I have taken 8 replicas of the
preamble and then correlated it with the signal. It is evident that there multiple peaks and

5
the peak with max has a bigger value as compare to Figure 6.

Fig. 7 CCF between the received signal and the 8 replicas of the preamble.

Part II Question 4: How does your output change when changing the order of the processes?
In other words, if the observed signal is defined as X and the preamble is defined as Y, how
does 𝑅XY (𝜏) compare to 𝑅YX (𝜏)?
Answer: The plot of the 𝑅XY (𝜏) and 𝑅YX (𝜏) are shown in Figure 8 respectively. It is evident
from the results that both are not the same. The one is the flipped left-right version of the
other and the index of the peak value is not the same.

6
Fig. 5 Zoomed sample mean vs the sample size
Part III
Question 5: Include a section (approximately 1 paragraph) in your report that discusses the
relationship between this project and other real-world issues. Clearly label the section.
Answer. Shot Noise in a p-n Junction Diode is an example where the random process,
correlation and covariance can be used to examine the nose.
We say that the shot noise process is asymptotically WSS. That is, after waiting a sufficiently
long period of time, the mean and autocorrelation functions will be invariant to time shifts.
In this case, the phrase “sufficiently long time” may mean a small fraction of a nanosecond!
So for all practical purposes, the process is WSS. Also, it is noted that the width of the
autocovariance function

7
5. Summary
In this project three main parameters ACF, CCF and PSD are analyzed for transmitted clean and
received noisy signal. It is observed that CCF is a good option problems were analyzed. In the first
problem,.

In the 2nd part of the project data of faulty lights was analyzed and it was observed that the sample
mean of a population is different from the true mean. However, it is evident from the results and
theoretically that the sample mean converges to the true mean as the population size increases.

6. Appendices (MATLAB Code for Part I, Part II)


5.1 MATLAB code for Part I

6 clear all
7 close all
8
9 n_vals = 50000; % Number of values to simulate
10 %n_vals = 5000;
11 na = 100; % Number of samples (repetitions) of each
value
12 A = 1; % Peak Amplitude
13 Fs = 100000; % Sampling rate i.e. samples/sec
14 dt = 1/Fs; % Sampling period i.e. Time between
samples
15
16 t = 0:dt:(n_vals*na*dt-dt);
17
18 vals = 2*A*(rand(1,n_vals) > 0.5) - A;
19 X = kron(vals, ones(1,na));
20
21 [Rx, lags] = xcorr(X, 'biased');
22
23 figure();
24 plot(t,X);
25 xlabel('Time (s)');
26 ylabel('x(t)');
27 title('Binary Process');
28 set(gca,'fontsize',12,'fontweight','bold')
29
30
31
32 % figure();
33 % plot(lags,Rx);
34 % title(['ACF of Binary process with t_a= '
num2str(na*dt)])
8
35 % xlabel('lags')
36 % ylabel('$R_x$','Interpreter','latex')
37 % set(gca,'fontsize',12,'FontWeight','bold');
38
39 figure();
40 plot(lags*dt,Rx);
41 title(['ACF of Binary process with t_a= '
num2str(na*dt)])
42 xlabel('\tau')
43 ylabel('$R_x(\tau)$','Interpreter','latex')
44 set(gca,'fontsize',12,'FontWeight','bold');
45
46 %% PSD using periodogram
47 %Compute the two-sided periodogram of Binary Signal
48 figure();
49 periodogram(X,[],'twosided',1024,Fs)
50 set(gca,'fontsize',12,'FontWeight','bold');
51
52 [f,x_psd]= X_PSD(X,Fs);
53
54 figure();
55 plot(f,x_psd)
56 xlabel('Frequency (Hz)');
57 ylabel('PSD');
58 title('PSD of the Binary Process')
59
60 % Question 2 Part I
61 cumulativePsD = cumsum(x_psd);
62 cumulativePsD = cumulativePsD/cumulativePsD(end);
63 figure();
64 plot(f,cumulativePsD,LineWidth=2)
65 xlabel('Frequency (Hz)');
66 ylabel('Cumulative PSD');
67 title('Cumulative PSD of the Binary Process')
68 set(gca,'fontsize',12,'fontweight','bold');
69 %% Part II
70 % Loading the noisy recieved signal
71 load('part2_2022.mat');
72 p= [-1 1 1 1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 1 1 1 1 -1 -1];
73 pp = repmat(p,1,8);
74 [rrx,la]= xcorr(p,signal_rx);
75 figure();

9
76 plot(la,rrx,LineWidth=2,Color='k');
77 xlabel('\tau')
78 ylabel('$Ryx(\tau)$','Interpreter','latex')
79 title('Cross Correlation of the preamble and the
recieved Signal')
80 set(gca,'fontsize',12,'FontWeight','bold');
81 %function
82 loc = preamble_loc(signal_rx)
83 function loc=preamble_loc(array)
84 p= [-1 1 1 1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 1 1 1 1 -1 -1];
85 [rrx,la]= xcorr(array,p);
86 [M I]=max(rrx);
87 loc = la(I);
88 end
89
90

10

You might also like