0% found this document useful (0 votes)
77 views

Department of Electrical Engineering EE365L: Communication Systems

The document describes a lab experiment on analyzing the energy spectral density (ESD) and power spectral density (PSD) of signals using MATLAB. The objectives are to analyze the ESD of an energy signal and PSD of a power signal. It provides background on ESD, PSD, autocorrelation and their relationships. It describes generating a sample signal, finding its autocorrelation and Fourier transform to plot the ESD. The lab tasks involve determining whether ESD/PSD exists for given signals and explaining the whiteness property of additive white Gaussian noise (AWGN) by finding the FFT of a signal and noisy signal.

Uploaded by

Abrahan Shahzad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

Department of Electrical Engineering EE365L: Communication Systems

The document describes a lab experiment on analyzing the energy spectral density (ESD) and power spectral density (PSD) of signals using MATLAB. The objectives are to analyze the ESD of an energy signal and PSD of a power signal. It provides background on ESD, PSD, autocorrelation and their relationships. It describes generating a sample signal, finding its autocorrelation and Fourier transform to plot the ESD. The lab tasks involve determining whether ESD/PSD exists for given signals and explaining the whiteness property of additive white Gaussian noise (AWGN) by finding the FFT of a signal and noisy signal.

Uploaded by

Abrahan Shahzad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Department of Electrical Engineering

EE365L: Communication Systems

Course Instructor: Dr. Muhammad Zubair Dated: 20th April, 2021

Lab Instructor: Tawahaa Ahmed Semester: 6th

Class: BSEE-18 Session: Spring-2021

Lab 4. Energy and Power Spectral Densities

Lab Marks Obtained


Name Roll No VIVA(5)
(10) Marks (15)
Muhammad Hamza
BSEE18078
Shahid

Checked on: _______________________________

Signature: ____________________________
Energy and Power Spectral Densities

4.1 Introduction
The energy spectral density and autocorrelation function of energy signals are important tools for
the characterization of energy signals. The other important class of signals we will study is the
power signals. Power signals are infinite in time, they remain finite as time t approaches infinity
and so, their energy is infinite.
Power signals are very important in communications, since they include:
• Periodic signals
• Channel white noise
• Most transmitted digital or analog signals (they are approximated as power signals, and they
can be considered infinite, since their duration is in general much longer than the inverse of the
bandwidth).
Therefore, it is desirable to have a counterpart of the energy spectral density and autocorrelation
function of energy signals for power signals. They are called power spectral density (PSD) and
autocorrelation function of power signals.

Objective
The purpose of this lab experiment is to:
Analyze the Energy Spectral Density (ESD) of an Energy signal using Matlab.
Analyze the Power Spectral Density (PSD) of a Power signal using Matlab.

4.2 Background
4.2.1 Energy Spectral Density (ESD)
The energy of a signal x(t) is

2
𝐸𝑥 = ∫ |𝑥(𝑡)| 𝑑𝑡 (5.1)
−∞


2
𝐸𝑥 = ∫ |𝑋(𝑓)| 𝑑𝑓 (5.2)
−∞

The equation (5.1) and equation (5.2) shows the same result and this is Parseval’s theorem,
which allows us to determine the signal energy from either the time domain specification 𝑥(𝑡) or
the frequency domain specification 𝑋(𝑓) of the same signal.
The correlation of a signal with itself is called the Autocorrelation. The Autocorrelation 𝑅𝑥(τ) of
a real signal x(t) is defined as

𝑅𝑥(τ) = ∫ (𝑥(𝑡)𝑥(𝑡 + τ))𝑑𝑡 (5.3)
−∞
It is a measure of the similarity of a signal with a delayed copy of itself. The Energy Spectral
Density (ESD) is defined as the energy contributed by the spectral component of frequency f of
the signal x(t) and is written as:
2
ψ𝑥(𝑓) = |𝑋(𝑓)| (5.4)
The energy, energy spectral density and autocorrelation function of energy signals are related and
have the following property:

𝐸𝑥 = ∫ ψ𝑥(𝑓)𝑑𝑓 (5.5)
−∞

4.2.2 Power Spectral Density (PSD)


The power of a signal x(t) is
+𝑇0
1 2
𝑃𝑥 = 2𝑇0
∫ |𝑥(𝑡)| 𝑑𝑡 (5.6)
−𝑇0

The correlation of a signal with itself is called the Autocorrelation. The Autocorrelation 𝑅𝑥(τ) of
a real signal x(t) is defined as
+𝑇0
1
𝑅𝑥(τ) = 2𝑇0
∫ (𝑥(𝑡)𝑥(𝑡 + τ))𝑑𝑡 (5.7)
−𝑇0
It is a measure of the similarity of a signal with a delayed copy of itself.
The equation (5.3) and equation (5.7) look similar but the main difference is normalization of
equation (5.7) with T0, for finding signal power.
The Power Spectral Density (PSD) is defined as the power contributed by the spectral
component of frequency f of the signal x(t) and is written as:
+∞
𝑆𝑥(𝑓) = ∫ 𝑅𝑥(τ)𝑒𝑥𝑝(− 𝑗2π𝑓τ))𝑑τ (5.8)
−∞
The Power, power spectral density and autocorrelation function of power signals are related and
have the following property:

𝑃𝑥 = ∫ 𝑆𝑥(𝑓)𝑑𝑓 (5.9)
−∞
4.3 Description
Consider the following Figure 5.1 of signal x(n) which shows a discrete time rectangular signal
with length N=5. The magnitude of the Fourier Transform of this signal is given below:
ω𝑁
sin𝑠𝑖𝑛
𝑋( ω ) = 2
ω (5.10)
sin𝑠𝑖𝑛 2
Plot the discrete time domain signal x(n) in Matlab using the following piece of code.

n=[-2:2] ;
x=[1 1 1 1 1 ] ;
stem(n , x ) ;
axis([-5 5 0 2])
title ('Discrete Signal in Time Domain')
xlabel Time
ylabel Amplitude
The output graph produced should be similar to one in Figure 5.1. Using the signal x[n], Find out
the Autocorrelation y[n] of the signal by using the Matlab function xcorr(x,x). An important
point to observe here is that the first sampling instant of Autocorrelation function y[n] should be
twice the first sampling instant of the signal x[n] itself. It is true for all the points of the
Autocorrelation function y[n]. Therefore, for writing the code for the Autocorrelation function
y[n] we need to generate a timing vector twice that of the signal x[n] itself.

Figure 4-1: Signal x[n]


n=[-2:1:2];
x=[1,1,1,1,1];
y=xcorr(x,x);
ny=[-4:1:4];
stem(ny,y)
axis([-5 5 0 6])
title ('Autocorrelation Function y[Tau]')
xlabel Tau
ylabel Amplitude

The Autocorrelation function y[n] should be similar to the Figure 5.2. In order to plot the Fourier
Transform F[n] of the Autocorrelation function y[n] the following piece of code is used.
Figure 4-2: Autocorrelation of Signal x[n]
M=20;
k=-M/2:M/2;
ny=[-4:1:4];
n=[-2:1:2];
x=[1,1,1,1,1];
y=xcorr(x,x);
w=(2*pi/M)*k ;
Y=y*(exp(-2*i*pi/M)).^(ny'*k) ;
stem(w,abs(Y))
axis([-4 4 0 30])
title ('Fourier Transform F[f]')

Figure 4-3: Fourier Transform of Signal y[Tau]


After plotting the Fourier Transform F[f] of the Autocorrelation Function y[n], find out the
Energy Spectral Density E[f] of the signal x[n] using its Fourier Transform. The Energy Spectral
Density E[f] of a signal is the magnitude square of its Fourier Transform. The following piece of
code finds out the Energy Spectral Density E[f].
N=5;
M=20;
i =1;
for k=-M/2:M/2
w=(2*pi/M)*k ;
if k==0
X(i)=N;
else
X(i)=sin(w*N/2)/sin(w/2);
end
i=i +1;
end
ESD=(abs(X)).^2 ;
w=(2*pi/M)*[-M/2:M/2];
stem(w,ESD)
axis([-4 4 0 30])
title ('ESD of Actual Signal')
Figure 5.3 representing the Fourier Transform F[f] of the Autocorrelation Function y[n] and
Energy Spectral Density E[f] of the signal x[n] represented by Figure 5.4 are similar to each
other thus showing that the Energy Spectral Density(ESD) of a periodic signal is equal to the
Fourier Transform of Autocorrelation of the signal.

Figure 4-4: Energy Spectral Density of Actual Signal


Plot all the figures on the same window using the subplot command for the ease of comparison.
Vary the period and range of the sampling points separately to observe their effects in Matlab.

n=[-2:1:2];
x=[1,1,1,1,1];
subplot (3,1,1);
stem(n,x)
axis([-3 3 0 1.5]);
title('Gate Function');
y=xcorr(x,x);
ny=[-4:1:4];
subplot (3,1,2);
stem(ny,y)
axis([-5 5 0 6]);
title('Autocorrelation') ;
M=20;
k=-M/2:M/2;
w=(2*pi/M)*k;
Y=y*(exp(-2*j*pi/M)).^(ny'*k);
subplot (3,1,3);
stem(w,Y)
title ('Energy Spectral Density');

Figure 4-5: Gate-Function, Auto-correlation & Energy Spectral Density

4.4 Lab Tasks


Task-1: [2 Marks]
Whether or not ESD/PSD exists for below mentioned signals?
Signals:
100𝑐𝑜𝑠(100π𝑡 + 90) , t: 0<t<100
𝑒𝑥𝑝(− 𝑡) 𝑢(𝑡) , t: 0<t<50
(𝑡) 𝑢(𝑡) , t: 0<t<10

(a)
The ESD/PSD exists for the function x = 100cos(100πt+ 90).
t = 0:0.01:100;
x = 100*cos((100*pi.*t)+ 90);
N = length(x);
Ns = 64;
PSD = abs(fft(x,Ns)).^2/N;
stem((0:(Ns-1))/Ns,PSD);
title('64-point PSD of the signal');
xlabel('Frequency (Hz)');
ylabel('Magnitude');

(b)
The ESD/PSD exists for the function x = exp(-t)u(t).
t = 0:0.01:50;
x = exp(-t);
N = length(x);
Ns = 128;
PSD = abs(fft(x,Ns)).^2/N;
stem((0:(Ns-1))/Ns,PSD);
title('128-point PSD of the signal');
xlabel('Frequency (Hz)');
ylabel('Magnitude');

(c)
The ESD/PSD exists for the function u(t).

t = 0:0.01:10;
x = t;
N = length(x);
Ns = 64;
PSD = abs(fft(x,Ns)).^2/N;
stem((0:(Ns-1))/Ns,PSD);
title('64-point PSD of the signal');
xlabel('Frequency (Hz)');
ylabel('Magnitude');
Task-2: [4 Marks]
Explain the Whiteness property of AWGN which states that noise PSD is a rect() function. You
have to find fft of signal and then find fft of noisy signal and then justify about the whiteness
property of AWGN [Use below mentioned signal]
{Whiteness Property: the uniform distribution of noise is the whiteness property of AWGN}
t = (0:0.1:10)';
x = sawtooth(t);
y = awgn(x,10,'measured');

t = (0:0.1:10);
x = sawtooth(t);
y = awgn(x,10,'measured');
X = fft(x);
Y = fft(y);
subplot(2,1,1), stem(t,abs(X));
title('FFT of the signal');
xlabel('Frequency (Hz)');
ylabel('Magnitude');
subplot(2,1,2), stem(t,abs(Y));
title('FFT of the noisy signal');
xlabel('Frequency (Hz)');
ylabel('Magnitude');

stem(t,abs(X));
hold on
stem(t,abs(Y));
title('FFTs of the signal and noisy signal');
xlabel('Frequency (Hz)');
ylabel('Magnitude');

By carefully observing the above figure, we deduce the fact


that the AWG noise adds to every frequency component of the
original signal. If the noise wasn’t added to the signal, the
signal would remain the same. By adding the AWGN signal, the
noise is distributed uniformly throughout the fft of the
signal.

Task-3: [4 Marks]
Below Figure shows a random binary pulse train g(t). The pulse width is Tb/2, and one binary
digit is transmitted every Tb seconds. A binary 1 is transmitted by the positive pulse, and a binary
0 is transmitted by the negative pulse. The two symbols are equally likely and occur randomly.
Determine the autocorrelation and PSD of the g(t).
Use: [pulstran(t,pulseperiods,@rectpuls,pulsewidth)]
Figure 4-6

T = 10;
t = 0:0.001:T-0.001;
n = randi([0,1],1,T);
L = length(n);
for i = 1:L
if(n(i) == 0)
n(i) = -1;
end
end
pperiods = [1:1:T;n]';
pulsewidth = 1/2;
g = pulstran(t,pperiods,@rectpuls,pulsewidth);
plot(t,g);
y = xcorr(g,g);
t = 0:0.001:2*(T-0.001);
stem(t,y);
title('Autocorrelation of g(x)');
xlabel('Time(sec)');
PSD = periodogram(g);
t = (0:length(PSD)- 1)’;
plot(t,PSD);
title('PSD of g(x)');
xlabel('Time(sec)');
Assessment Rubrics
EE365: Communication Systems – Lab __
Method: Lab reports and instructor observation during lab sessions

Outcome Assessed:

a. Ability to conduct experiments, as well as to analyze and interpret data (P).


b. Ability to function on multi-disciplinary teams (A).
c. Ability to use the techniques, skills, and modern engineering tools necessary for
engineering practice (P).

Exceeds expectation Meets expectation Does not meet


Performance Marks
(4-5) (3-2) expectation (1)
Selects relevant Needs guidance to Incapable of
equipment to the select relevant selecting relevant
experiment, develops equipment to the equipment to
setup diagrams of experiment and to conduct the
1. Realization of equipment connections develop equipment experiment,
Experiment [a, c] or wiring. connection or wiring equipment
diagrams. connection or wiring
diagrams are

Actively engages and Cooperates with other Distracts or


cooperates with other group members in a discourages other
group members in an reasonable manner. group members
2. Teamwork [b] effective manner. from conducting the
experiment.

Does proper Calibrates equipment, Unable to calibrate


calibration of examines equipment appropriate
equipment, carefully moving parts, and equipment, and
examines equipment operates the equipment equipment operation
3. Conducting moving parts, and with minor error. is substantially
Experiment [a, c] ensures smooth wrong.
operation and process.

Respectfully and Observes safety rules Disregards safety


carefully observes and procedures with rules and
4. Laboratory safety rules and minor deviation. procedures.
Safety Rules [a] procedures
Exceeds expectation Meets expectation Does not meet
Performance Marks
(5-4) (3-2) expectation (1)
Plans data collection Plans data collection Does not know how to
to achieve to achieve plan data collection to
5. Data experimental experimental achieve experimental
objectives, and objectives, and goals; data collected is
Collection [a]
conducts an orderly collects complete data incomplete and
and a complete data with minor error. contain errors.
collection.
Accurately conducts Conducts simple Unable to conduct
simple computations computations and simple statistical
and statistical analysis statistical analysis analysis on collected
using collected data; using collected data data; no attempt to
correlates with minor error; correlate experimental
experimental results to reasonably correlates results with known
6. Data Analysis known theoretical experimental results to theoretical values;
[a] values; accounts for known theoretical incapable of
measurement errors values; attempts to explaining
and parameters that account for measurement errors or
affect experimental measurement errors parameters that affect
results. and parameters that the experimental
affect experimental results.
results.
Uses computer to Uses computer to Does not know how to
7. Computer Use collect and analyze collect and analyze use computer to
[a] data effectively. data with minor error. collect and analyze
data.

Total

Lab Engineer:

Name:

Signature:

Date:

You might also like