Temple University Pulse Code Modulation Lab Report

1Signal Processing in MATLAB: Reconstructing Signals, Estimating Amplitude, Phase, and
Power Spectral Density, and Addressing the Effects of Noise
INTRODUCTION
The discussion is on the analysis of various signals in MATLAB, including triangular,
sinusoidal, and signals tainted with additive white Gaussian noise (AWGN).
ANALYSIS
Creation of a triangle waveform and calculation of its power spectral density, phase, and
amplitude.
AWGN-corrupted sinusoidal signal generation with SNR of 0 dB and power spectral density
observation.
code modification to convert the sample index on the X-axis to physical time.
examining how the Fast Fourier Transform performs when the value of N is changed (FFT).
following estimation, reassembling the original signals.
CONCLUSION
The discussion comes to the conclusion that the MATLAB program can be utilized for a variety
of signal analyses, such as estimating height, phase, and the power spectral density. Power
spectral density measurement is also helpful in identifying the existence of noise in the data.
However, because noise is random, the outcomes could differ. The results are more physically
meaningful and intuitive as a result of the code patch that switches the X-axis from sampling
index to physical time. Due to the varied shapes of the waveforms, the number of real number
2
Fourier series for triangular waveforms differs from those for sinusoidal waveforms. The
reconstructed impulses are seen to correspond to the original signals, giving the analysis
credibility.
Digital Communication Systems Laboratory
Spring 2023
Lab 3: Pulse Code Modulation
Laboratory Goal
• Introducing pulse code modulation.
• Generating different kind of line coding.
• Investigating power spectrum of the line coding schemes.
PCM: A message signal is represented by a sequence of coded pulses, which is accomplished by representing the signal in discrete form in both time and amplitude.
The basic operations performed in the transmitter of a PCM • Sampling
• Quantization
• Encoding : Sampling and quantization transforms a continuous signal to a discrete set of values.
But they are not in the best suited to transmission over a line or radio path. Encoding process to
translate the discrete set of sample values to a more appropriate form of signal, which can make
the transmitted signal more robust to noise, interference, and other channel degradations.
Figure 1: PCM Transmitter
1
Line codes: It is in a line code that a binary stream of data takes on an electrical representation. Fig.
2 depicts different line coding scheme for a binary data 0 1 1 0 1 0 0 1.
(a) Unipolar Non return to zero
(b) polar Non return to zero
(c) Unipolar return to zero
(d) Bipolar return to zero
(e) Manchester code
(f) Differential encoding
Figure 2: Line codes
Symbol rate vs bit rate
• Number of symbol = M
• Number of bits/symbol = ⌈log2 M⌉
• Bit rate = rb .
• Symbol rate =
rb
Nb
Figure 3: Bit rate vs symbol rate
Bandwidth: Desirable BW characteristics from a line code:
1. No DC and insignificant low frequency components.
2. Narrow bandwidth.
2
(a) Unipolar Non return to zero
(b) Polar Non return to zero
(c) Unipolar return to zero
(d) Manchester
Tasks: Use these parameters for all the following tasks:
a. Amplitude ((A): TUID(9) + 2) Volt.
b. Frequency (f ): (TUID(8) + 3) KHz
1. Use two of the following waveforms based on your TUID(7) and plot corresponding binary encodings and discuss the pros and cons to the corresponding coding schemes.
TUID(7)
0,1
2,3
4,5
6,7
8,9
Encoding 1
Encoding 2
Bipolar RZ
Manchester
Polar RZ
Differential
Bipolar NRZ
Differential
Bipolar RZ
Manchester
Polar NRZ
Manchester
2. Plot the spectrum of assigned encodings in dBW. Fill the following table
Parameter
Symbol rate
Bit rate
Encoding 1
Encoding 2
3
3 dB BW
Null BW
1
Signal Processing in MATLAB: Reconstructing Signals, Estimating Amplitude, Phase, and
Power Spectral Density, and Addressing the Effects of Noise.
Student name:
Professor name:
Institution name:
Date:
2
QUESTION 1
N = 256;
fs = 1000; % Sample rate
t = (0:N-1)/fs; % Physical Time vector
f = (-N/2:N/2-1)*(fs/N); % Frequency band vector
x = sin(2*pi*100*t) + 0.5*sin(2*pi*200*t); % Input signal
X = fftshift(fft(x)); % FFT of the signal
% Plot the signal in frequency domain
figure;
subplot(2,1,1);
plot(f,abs(X));
title(‘Frequency Domain’);
xlabel(‘Frequency (Hz)’);
ylabel(‘Amplitude’);
% IFFT and IFFT shift to reconstruct the signal
3
x_recon = ifft(ifftshift(X));
% Plot the reconstructed signal in time domain
subplot(2,1,2);
plot(t,x_recon);
title(‘Time Domain’);
xlabel(‘Time (s)’);
ylabel(‘Amplitude’);
QUESTION 2
% Define the original signal
x = (1:2^22).*sin(2*pi*1000*(1:2^22)/8000);
% Loop through different values of N
for N = 2.^(8:2:22)
% FFT of the original signal with N samples
X = fft(x(1:N));
4
% Plot the magnitude of the FFT
figure;
plot(abs(X));
title(sprintf(‘N = %d’, N));
xlabel(‘Sample index’);
ylabel(‘Magnitude’);
end
QUESTION 3
Triangular waveform
% Generate triangular waveform
t = 0:0.01:2;
x = sawtooth(2pit, 0.5);
% Estimate amplitude and phase
X = fft(x);
amp = abs(X);
phase = angle(X);
5
% Estimate power spectral density
Pxx = X.*conj(X)/length(X);
% Reconstruct the original signal
x_recon = ifft(X);
Due to the fact that both the sinusoidal and triangular waveforms are periodic signals, the
quantity of real number Fourier coefficients for each waveform is equal. An infinite
accumulation of harmonic of uneven ordering, with falling amplitude and increasing phase, can
be used to depict the triangle waveform.
If the length of the FFT is sufficient to faithfully represent all the harmonics, the reconstructed
signal ought to be identical to the original one. A number of the higher harmonics won’t be
captured if the FFT is too short, which will result in errors in the signal reconstruction.
BONUS QUESTION
clear;
A = 1;
f = 10;
theta = 0;
fs = 1000;
6
T = 1/fs;
t = 0:T:1-T;
x = A*cos(2*pi*f*t + theta);
snr = 0; % dB
noise = randn(1,length(t))*10^(-snr/20)*A;
x_noisy = x + noise;
figure;
subplot(311)
periodogram(x_noisy, [], length(x_noisy), fs);
title(‘Power Spectral Density – 1’);
subplot(312)
periodogram(x_noisy, [], length(x_noisy), fs);
title(‘Power Spectral Density – 2’);
subplot(313)
periodogram(x_noisy, [], length(x_noisy), fs);
title(‘Power Spectral Density – 3’);
The PSD may not remain the same every time because the noise added to the signal is random.
Hence, the PSD will change every time you run the code. To get an average PSD, you can run
7
the code multiple times and average the PSDs, or you can use Welch’s method to estimate the
PSD.

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER