Department of Electrical Engineering
Faculty of Engineering & Applied sciences
Riphah International University Islamabad, Pakistan
Program: B.Sc. Electrical engineering Semester: VI
Subject EE-347 communication system Date: …………….
Experiment No.2 Implementation of Energy Spectrum Density (ESD) ,Power Spectrum Density PSD
and autocorrelation of the signals using MATLAB.
OBJECTIVES:
(i) The objective of this experiment is to calculate and plot exponential Fourier series coercions.
Aqib Habib 45575
Performance Lab Report
Description Total Marks Description Total Marks
Marks Obtained Marks Obtained
Ability to conduct 5 Organization/Structure 5
Experiment Data Presentation 5
Work Ethics Individual and Team Performance
Description Total Marks Description Total Marks
Marks Obtained Marks Obtained
Adherence to Team Collaboration and Contribution
Safety Guidelines
Individual Task Performance
Remarks (if any) ……………………………………….
Instructor’s Signature: ………………………………
Introduction:
In signal processing, understanding the spectral characteristics of a signal is crucial. The Energy Spectral Density
(ESD) and Power Spectral Density (PSD) provide insights into how energy and power are distributed over different
frequencies. Autocorrelation measures the similarity of a signal with a time-shifted version of itself, which is useful
in detecting periodic patterns.
Key Concepts:
Energy Spectral Density (ESD): Represents the distribution of a signal’s energy over different frequencies.
For an energy signal x(t)x(t)x(t):
ESD=∣X(f)∣2ESD = |X(f)|^2ESD=∣X(f)∣2
where X(f)X(f)X(f) is the Fourier Transform of x(t)x(t)x(t).
Power Spectral Density (PSD): Represents the power distribution over frequency for a power signal. It is
given by:
PSD=limT→∞∣XT(f)∣2TPSD = \lim_{T \to \infty} \frac{|X_T(f)|^2}{T}PSD=T→∞limT∣XT(f)∣2
where XT(f)X_T(f)XT(f) is the Fourier Transform of the time-limited signal.
Autocorrelation Function: Measures the similarity of a signal with its delayed version. It is defined as:
Rx(τ)=∫−∞∞x(t)x(t+τ)dtR_x(\tau) = \int_{-\infty}^{\infty} x(t) x(t+\tau) dtRx(τ)=∫−∞∞x(t)x(t+τ)dt
where Rx(τ)R_x(\tau)Rx(τ) represents the autocorrelation at time lag τ\tauτ.
Procedure:
1. Define a test signal: Choose a signal (e.g., sine wave, square wave, or random signal).
2. Compute ESD:
o Take the Fourier Transform of the signal.
o Compute the squared magnitude of the frequency components.
3. Compute PSD:
o Use the periodogram function in MATLAB.
4. Compute Autocorrelation:
o Use the xcorr function in MATLAB.
5. Plot results: Generate plots for the computed ESD, PSD, and autocorrelation.
MATLAB Code:
Below is the MATLAB script for % Compute Energy Spectral % Plot Power Spectral Density
computing and plotting ESD, Density (ESD) (PSD)
PSD, and Autocorrelation for a
random signal. ESD = abs(X_f).^2; figure;
matlab % Compute Power Spectral plot(f_psd, PSD, 'r', 'LineWidth',
Density (PSD) 2);
CopyEdit
[PSD, f_psd] = periodogram(x, xlabel('Frequency (Hz)');
clc; clear; close all; rectwin(length(x)), length(x), Fs, ylabel('PSD');
'centered');
title('Power Spectral Density
% Compute Autocorrelation (PSD)');
% Define Parameters
[R_x, lag] = xcorr(x, 'unbiased'); grid on;
Fs = 1000; % Sampling
frequency % Plot Energy Spectral Density % Plot Autocorrelation
(ESD)
T = 1; % Signal duration figure;
figure;
t = 0:1/Fs:T-1/Fs; % Time vector plot(lag/Fs, R_x, 'g', 'LineWidth',
plot(f, ESD, 'b', 'LineWidth', 2); 2);
x = randn(size(t)); % Random
signal xlabel('Frequency (Hz)'); xlabel('Time Lag (s)');
ylabel('ESD'); ylabel('Autocorrelation');
% Compute Fourier Transform
title('Energy Spectral Density title('Autocorrelation of the
X_f = fftshift(fft(x)); (ESD)'); Signal');
f = linspace(-Fs/2, Fs/2, grid on; grid on;
length(X_f));
MATLAB Plots:
The MATLAB script generates the following plots:
1. Energy Spectral Density (ESD): Displays energy distribution across frequencies.
2. Power Spectral Density (PSD): Shows power distribution of the signal.
3. Autocorrelation Function: Visualizes the self-similarity of the signal over different time lags.
Conclusion:
In this experiment, we successfully computed and visualized the Energy Spectral Density (ESD), Power Spectral
Density (PSD), and Autocorrelation of a signal.
The ESD plot shows how the signal’s energy is distributed in the frequency domain.
The PSD plot reveals the power characteristics of the signal, which is useful in signal analysis and noise
filtering.
The Autocorrelation function helps in detecting periodicity and signal similarity over time.