0% found this document useful (0 votes)
17 views24 pages

Homework Digital

This document outlines a homework assignment for a Master's course in Telecommunications at Université Abdelmalek Essaâdi, focusing on Pulse Code Modulation (PCM). It details objectives, MATLAB functions for uniform quantization, case studies with sinusoidal signals, and calculations for quantization levels and signal-to-noise ratios. The document includes MATLAB code snippets, waveform representations, and theoretical explanations related to PCM and quantization processes.

Uploaded by

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

Homework Digital

This document outlines a homework assignment for a Master's course in Telecommunications at Université Abdelmalek Essaâdi, focusing on Pulse Code Modulation (PCM). It details objectives, MATLAB functions for uniform quantization, case studies with sinusoidal signals, and calculations for quantization levels and signal-to-noise ratios. The document includes MATLAB code snippets, waveform representations, and theoretical explanations related to PCM and quantization processes.

Uploaded by

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

Université Abdelmalek Essaâdi Année universitaire 2024-2025

Faculté des Sciences de Tétouan Filière Master : Télécommunication (TC)

Homework
Pulse Code Modulation
(PCM)

Présenté par: Encadré par:


 Bouzian
 Pr M.ennasar
Hajar
Homework1:
Objectives
In this lab experiment, the MATLAB software will be used to understand
and simulate the basic concepts and mechanisms of uniform and
nonuniform PCM quantizes. The main objective of this lab study is:
1. To study the quantization process of PCM schemes 2 .
2. To synthesize the coding process of PCM schemes.
3. To compare and analyze uniform and non-uniform quantization
schemes .

 Uniform Quantization :
 Function: uniform_pcm :
This function, given next, takes as its input a sequence of sampled values
(m_samp) and the number of desired quantization levels (L) and finds the
quantized sequence (m_quan), the encoded sequence (code), and the
resulting SQNR (sqnr) in dB. It is used in uniform quantization and it is
also used with other functions in nonuniform quantization.
function [sqnr,m_quan,code]=uniform_pcm(m_samp,L)
global q
%UNIFORM_PCM uniform PCM encoding of a sequence
% [sqnr,m_quan,code]= uniform_pcm(m_samp,L)
% m_samp = input sampled sequence.
% L = number of quantization levels (even).
% sqnr = output SQNR (in dB). %
% idx_quan = index of quantized output.
% m_quan = quantized output before encoding.
% code = the encoded output.
m_max = max(abs(m_samp)); % Find the maximum value of m_samp.
m_quan = m_samp/m_max; % Normalizing m_samp.
idx_quan = m_quan; % Quantization index.
MATLAB
delta = 2/L; % Quantization step.
q = delta.*[0:L-1]; % Define quantization regions.
CODE

q = q-((L-1)/2)*delta; % Centralize all quantization levels


% around the x-axis.
for i=1:L
m_quan((q(i)-delta/2 <= m_quan) & (m_quan <= q(i)+delta/2))=...
q(i).*ones(1,length(find((q(i)-delta/2 <= m_quan) & ...
(m_quan <= q(i)+delta/2))));
idx_quan(m_quan==q(i))=(i-1).*ones(1,length(find(m_quan==q(i))));
end
m_quan;
idx_quan;
m_quan = m_quan * m_max; % Release normalization for quantized values.
R =ceil(log2(L)); % Define no. of bits per codeword.
code = de2bi(idx_quan', R, 'left-msb'); % Generate codewords.
sqnr = 20 * log10(norm(m_samp)/norm(m_samp - m_quan)); % Estimate SQNR.
Case study I:
Here, we will use the following sinusoidal function (S(t)=
A*sin(2πft)) as an analog signal. This example is just an
illustrative with low sampling frequency. It is used to allow you to
investigate easily on the resulting outputs. Two figures will be
generated; the first one shows the original input signal and its
samples whereas the second shows the normalized signal with
quantized values. In addition, the SQRN and the encoded
quantized samples (code-words) are returned. Remember that
this mid-rise uniform quantization where the number of
1) Write down
quantization the has
levels samples
to beofeven
the (e.g.
signal, their
8 as quantized
in this values,
example).
and their code words.
m_samp = 0 7.0711 10.0000 7.0711 0.0000 -7.0711 -
10.0000 -7.0711 -0.0000
sqnr = 15.8049
m_quan =-1.2500 6.2500 8.7500 6.2500 1.2500 -6.2500 -8.7500
-6.2500 -1.2500
% MATLAB script for Illustrative Example uniform_ex1.m
clc;
clear;
close all
% echo on
global q
t = [0:pi/100:2*pi];
m = 10 * sin(t); code =
t_samp = [0:pi/4 :2*pi];
m_samp = 10 * sin(t_samp)
figure(1) 0 1
plot (t,m, '-b','linewidth', 2)
hold on 1
stem (t_samp,m_samp, '--ro','linewidth', 2) 1 1
MATLAB

hold on
legend('original signal','sampled signal'); 0
CODE

axis([0 2*pi -15 15]) 1 1


L=8;
[sqnr,m_quan,code]=uniform_pcm(m_samp,L) 1
figure(2) 1 1
plot (t,m/max(m),'-b','linewidth', 2)
hold on 0
stem (t_samp,m_samp/max(m), '--ro','linewidth',2) 1 0
hold on
for i=1:L 0
plot (t,q(i)* ones(1,length(t)),'--g'); 0 0
hold on
end 1
legend('normalized original signal','normalized sampled signal'); 0 0
axis([0 2*pi -1.5 1.5])
echo off 0
0 0
1
2) Show the waveforms of the second figure generated on a full page.
Define the quantization regions, indicate the quantization levels,
indicate the amplitudes of the quantized samples, and show how
quantized samples have been successfully mapped to the
corresponding quantization levels.

Waveforms
Representation:
The second figure represents:

 Original Signal (blue curve): A smooth


sinusoidal signal.
 Sampled Signal (red circles): A
discrete version of the signal sampled
at specific intervals.
 Quantized Signal: The sampled values
are mapped to the nearest
quantization levels.
Summary Table:

Sample Value Region Quantized Value Binary Code


0.9 [0.75,1.125) 0.9375 110
−0.4 [−0.375,0) −0.1875 011
0.2 [0,0.375) 0.1875 100
−1.3 [−1.5,−1.125) −1.3125 000
0.0 [0,0.375) 0.1875 100

 Signal amplitude range -1.5 to 1.5


 Number of quantization levels (L) 8
 Total amplitude 1.5 – (-1.5) = 3.0
 Quantization step size (Δ) Δ = = = 0.375
3) On your sketch above, show the assigned cod-words to each
quantization level and show that the code words obtained are correct:

Sample Point Normalized Value Quantization Level Code Word


Point 1 0.0 Level 5 100
Point 2 0.7 Level 8 111
Point 3 1.0 Level 9 1000
Point 4 0.7 Level 8 111
Point 5 0.0 Level 5 100
Point 6 -0.7 Level 3 010
Point 7 -1.0 Level 1 000
Point 8 -0.7 Level 3 010
Point 9 0.0 Level 5 100

•Normalized Values: These correspond to the red sampled points in the normalized signal graph (Figure 2).
•Quantization Levels: Quantization levels are based on the ranges defined by the green dashed lines in
Figure 2 (e.g., -1 to -0.8 for Level 1, and so on).
•Code Words: Unique binary code words are assigned to each quantization level.
Case study II:
In this part, we will use the above developed code to generate a sinusoidal signal
with amplitude =4. Using uniform quantization, the samples sequence is
quantized using 8 and 16 quantization levels. Its plots the original signal and the
quantized signal on the same axes.
% MATLAB script for Illustrative Example uniform_ex2.m legend('Original', 'Quantized (L=8)', 'Quantized
clc; clear; close all (L=16)', 'Location', 'SouthEast');
echo on % pause % Press a key to see the first 5 samples,
t_samp = [0:0.01:10]; corresponding quantized
m_samp = sin(t_samp);
% % values, and corresponding codewords with
[sqnr_8L, m_quan_8L, code_8L] = uniform_pcm(m_samp, 8);
8 quantization levels
[sqnr_16L, m_quan_16L, code_16L] = uniform_pcm(m_samp,
16); % m(1:5)
pause % Press a key to see the SQNR for L = 8. % m_quan_8L(1:5)
sqnr_8L; % code_8L(1:5)
pause % Press a key to see the SQNR for L = 16. % pause % Press a key to see the first 5 samples,
sqnr_16L; corresponding quantized
pause % Press a key to see the plot of the signal and % % values, and corresponding codewords with
its quantized versions. 16 quantization levels
t = t_samp; m = m_samp; % m(1:5)
plot(t, m, 'linewidth', 2, ... % m_quan_16L(1:5)
t, m_quan_8L, '-.', ...
% code_16L(1:5)
t, m_quan_16L, '-', ...
echo off
t, zeros(1, length(t)));
1) Determine the sampling frequency used in this example:

The sampling frequency (fsf_sfs​) is determined by the time step


between consecutive samples.
t_samp = [0:0.01:10];
•The
In thetime
script:
step (Δt) is 0.01 seconds.
•The sampling frequency is the reciprocal of the Fs = = = 100Hz.​
time step :
2) Record the SQRN obtained in the two cases where the number of
quantization levels, L is 8 and 16. Compare the values obtained.
Justify your answer:
The script computes the Signal-to-Quantization-Noise Ratio (SQNR) for
two cases:
•Case 1: L=8L quantization levels.
•Case 2: L=16L quantization levels.
General Relationship Between LLL and SQNR:
The SQNR is a measure of the quality of quantization. It is given by:
SQNR=6.02⋅b+1.76(dB)
where b=log⁡2(L) is the number of bits used for quantization.
For L=8L :
 b=log⁡2(8)=3bits.
 SQNR≈6.02⋅3+1.76=19.82 dB

For L=16L :
 b=log⁡2(16)=4 bits.
 SQNR≈6.02⋅4+1.76=25.84 dB.

Comparison:
•The SQNR for L=16L = 16L=16 is higher than for L=8L = 8L=8. This is
expected because increasing the number of quantization levels reduces
quantization noise, thereby improving the SQNR.
•SQNR for L=8L : Approximately 19.82 dB.
•SQNR for L=16L : Approximately 25.84 dB.
•Justification: A larger number of quantization levels improves the resolution and reduces
quantization error, leading to a higher SQNR.
3) View the Matlab figure generated in full screen and observe the
nature of the two quantization signals. Relate your observation to the
SQRN values obtained above.
•Observation: The quantized signal for L=16L is smoother and closer to the original
signal compared to L=8L .
•Relation: The improved quality for L=16L aligns with the higher SQNR obtained, as
more quantization levels reduce the quantization noise.
Homework2:
1- A telephone signal with cut-off frequency of 4 khz is digitzed into bit
PCM, sampled
•Sampling at nyquist
rate (Nyquist rate): rate. Calculate
fs = 2 × fc baseband
= 2 × 4000 =transmission
8000 Hz.
bandwidth and quantization
•Baseband transmission S/N ratio:
bandwidth (BW):
The transmission bandwidth is: BW= fs/2 = 4000 Hz
•Quantization S/N ratio:
For a PCM signal with nnn bits per sample, the quantization SNR is:
SNR=6.02n+1.76 dB.
Assuming n=8 bits (standard for telephone PCM), we have:
SNR=6.02×8+1.76=49.92 dB
2- A telephone signal band limited to 4 kHz is to be transmitted by PCM.
The signal to quantization noise is to be at least 40 db. Find the number of
levels into which the signal has to be encoded. Also find the bandwidth of
transmission.
o Number of quantization levels (LLL):
Using the SNR formula: SNR=6.02n+1.76
For SNR=40 dB: 40=6.02n+1.76 ⟹ n = ≈ 6.36.40
Rounding up, n=7 bits. The number of quantization levels is: L===128
levels.
o Transmission bandwidth:
The transmission bandwidth is equal to the sampling rate, so:
BW=fs=2×fc=8000 Hz
3- An audio signal has its spectral components limited to the frequency
band of 0.3 to 3.3 kHz. A PCM signal is generated with sampling rate of
8000 samples/sec. the required output signal to quantizing noise is 30 dB.
 Minimum number of quantization levels (LLL):
Using the SNR formula: SNR=6.02n+1.76 and 30=6.02n+1.76
Solving for nnn: n = ≈ 4.7
Rounding up, 𝑛=5 bits per sample. The number of levels is: L===32.

 Minimum number of bits per sample: n=5

 Minimum system bandwidth:


The bandwidth required for PCM is given by: BW=n×fs=5×8000=40 kHz
4- Find the output of the matched filter and determine the maximum value
of (S/N)0 if the input S(t) is a rectangular pulse of amplitude A and duration
T.
•Output of the matched filter:
For a rectangular pulse, the output of the matched filter is a
triangular function with a duration of 2T.
•Maximum value of:
The SNR at the filter output is given by: =

5- A discrete signal S(t) is transmitted through an AWGN channel where the


white noise n(t) has a two sided noise spectral density equal N0/2. Given
that the signal is: 𝑆(𝑡) = {𝐴 𝑐𝑜𝑠(ω0 𝑡) 0≤𝑡≤𝑇 0 𝑜𝑡ℎ𝑒𝑤𝑖𝑠e:
1. Impulse response of the matched filter:
The impulse response of the matched filter is:
h(t)=Acos⁡(ω0t), 0≤t≤T
2. SNR at the matched filter output:
The output SNR is given by: SNR≈​
3. When T≫1:
For high-frequency signals where T≫1 , the expression remains:
SNR≈​
6- Consider the signal s(t) shown in below Figure.

1) Impulse Response of the Matched Filter:


The impulse response of a matched filter is the time-reversed and shifted
version of the input signal.
If s(t) is defined in the range [0,T], then the impulse response h(t) is given by:
h(t)=s(T−t).
2) Matched Filter Output:
The exact expression depends on the shape of s(t). You would reverse s(t)
The output of the matched filter, y(t) is the convolution of the signal s(t) with the
about T/2 and shift it.
matched filter impulse response h(t): y(t)=
Substituting h(t)=s(T−t) the output y(t) becomes a triangular or peaked function
(depending on s(t) with its maximum at t=T.

3) Peak Value of the Output:


The peak value of the matched filter output corresponds to the total energy of the
signal s(t), given by:
=
7- Consider the two digital modulation schemes shown in the figure below. For
each scheme, determine the minimum distance between two symbols dmin , the
average energy per symbol Eav , and the average energy per transmitted bit
 Minimum
Eb Distance
. Which scheme is Between Two Symbols
more efficient in terms():of transmission energy usage?
​is the smallest Euclidean distance between any two constellation points in the
modulation scheme.
For specific constellations:
• Binary Modulation (e.g., BPSK): dmin=2A where A is the amplitude.
• Higher-Order Modulations (e.g., QPSK, 16-QAM): ​depends
on the grid spacing in the constellation.
 Average Energy Per Symbol ():
The average energy per symbol is computed as: =
where M is the total number of symbols, and sis_isi​is the energy of the i-th symbol.
 Average Energy Per Transmitted Bit ():
The average energy per bit is related to the average energy per symbol: =
 Which Scheme is More Efficient?
A modulation scheme is more energy-efficient if it requires less energy per bit ()to
achieve the same bit error rate (BER). Typically, schemes like QPSK are more energy-
efficient than higher-order schemes like 16-QAM, especially in low SNR conditions.
8- Consider a channel with bandwidth 1MHz.
1) Noiseless Channel
Using the Shannon-Hartley theorem for a noiseless channel: C=2×B×log⁡2(M)
where C is the data rate, B is the bandwidth, and M is the modulation order.
• For 2-ASK (M=2): C=2××log⁡2(2)=2 Mbps
• For 8-ASK (M=8M = 8M=8): C=2××log⁡2(8)=6 Mbps
2) Noisy Channel
If the channel SNR is given, we use the Shannon capacity formula: C=B×log⁡2(1+SNR)
For SNR = 10 dB (SNR= = 10):
C=×log⁡2(1+10)≈×3.459=3.459 Mbps
For SNR = 30 dB (SNR= = 1000):
C=×log⁡2(1+1000)≈×9.967=9.967 Mbps
9- In a additive white Gaussian noise channel with noise power spectral
density of N0/2, two equi-probable message are transmitted by
1) Structure of the Optimal Receiver:
The optimal receiver for detecting messages in an AWGN channel is the
matched filter. It maximizes the signal-to-noise ratio at the sampling point. The
filter impulse response h(t) is matched to the transmitted signal s(t):
h(t)=s(T−t) where T is the duration of the signal.
2) Probability of Error:
For binary signaling, the probability of error is given by: Pe= Q ()
where Es​is the energy per symbol, N0​is the noise power spectral density, and
Q(⋅)Q(\cdot)Q(⋅) is the Q-function.
10- Consider the binary sequence 0101101. Draw the waveforms for the
•Unipolar
following NRZ Signaling:
signaling formats.
•Logic "1" is represented by a positive level (e.g., +V).
•Logic "0" is represented by 0 voltage.
Waveform alternates between 0 and +V based on the binary sequence.
•Bipolar RZ Signaling:
•Logic "1" is represented by a positive level for half the bit duration, followed by 0.
•Logic "0" is represented by a negative level for half the bit duration, followed by 0.
The waveform will alternate between positive and negative pulses, with zero voltage
in between.
11- In a binary PCM system, the output signal to quantization noise ratio is
to be held to a minimum of 40 dB. Determine the number of required levels,
and find the corresponding output signal to quantizing noise ratio.
• Number of Quantization Levels:
Using the SNR formula: SNR=6.02n+1.76
Solving for nnn: 40=6.02n+1.76 ⟹ n = ≈ 6.36
Round up to n=7 bits per sample.
The number of quantization levels is: L===128
• Corresponding SNR:
For n=7, the actual SNR is: SNR=6.02×7+1.76=43.9 dB

12- A binary baseband communication system uses the signal set consisting of
s0 (t)=s(t) and s1 (t)=-s(t) with equal probability, where
The channel is AWGN channel with double sided noise power spectral
desnity N0/2.
a) Minimum Error Probability:
The minimum error probability for a binary AWGN system is: Pe=Q()
where Es​is the signal energy, and N0​is the noise spectral density.
b) Impulse Response of the Receiving Filter:
The impulse response h(t)of the matched filter is matched to s(t):
h(t)=s(T−t) where T is the signal duration.
c) Optimum Sampling Time and Threshold:
•Sampling Time: The optimal sampling time is at t=T, where the filter output is
maximized.
•Threshold: The threshold for detection is typically set to zero, assuming equal
probability and symmetric signals: Threshold=0
13- A multi-level digital communication system sends one of 32 possible
levels over a channel every 0.8 milliseconds.
a) Number of Bits per Level:
The number of bits per level is: b=log⁡2(M),
where M=32 b=log⁡2(32)=5 bits
b) Baud Rate:
The baud rate is the symbol rate, which is the reciprocal of the symbol duration:
Baud rate =
where Ts=0.8 ms = 0.8 × s
Baud rate =

c) Bit Rate:
The bit rate is the product of the baud rate and the number of bits per symbol:
Bit rate = Baud rate×b = 1250×5= 6250bps.

14-An analog signal has time variation f(t) = 3 + 0.2 cos (8000π t) -
0.3 sin (4000π t) .
1.Minimum Sampling Rate (Nyquist):
Identify the highest frequency component: 8000π rad/s ⟹ = =
4000 H
The Nyquist sampling rate is: ≥ 2×=2×4000 = 8000 Hz

2.Number of Bits per Sample:


With 256 quantization levels: b=log⁡2(256)=8 bits per simple
3.Minimum Transmission Rate:
The transmission rate is the product of the sampling rate and the number of bits
per sample:
R=fs×b=8000×8=64 kbps
4.Allocating a 256 kbps Channel:
Since R=64 kbps a 256 kbps channel is sufficient.
5.Allocating a 32 kbps Channel:
Since R>32 kbps , a 32 kbps channel is not sufficient.
15- The following is a BPSK transmission:

a.Determine the Transmitted Bits:


In BPSK, each bit corresponds to one of two phases (0° or 180°). The phase
information determines the transmitted bit:
•A 0° phase represents bit "0".
•A 180° phase represents bit "1".
The exact transmitted bits depend on the phase diagram or signal representation
provided in the question.
b.Determine the Bit Rate:
The bit rate for BPSK is: Bit rate =
Bit rate=Symbol rate
For BPSK, there is one bit per symbol, so:
c.QAM is a Combination of Which Modulations?:
Quadrature Amplitude Modulation (QAM) combines amplitude modulation (AM) and
phase modulation (PM). It varies both the amplitude and the phase of the carrier
signal.
16- A modulation using rectangular pulse shaping achieves a spectral
efficiency ( as defined in the lecture notes) of 3 bps/Hz.
•Possible Modulation Scheme:
A spectral efficiency of 3 bps/Hz can be achieved with higher-order modulations,
such as:
•8-QAM (Quadrature Amplitude Modulation)
•64-QAM (for even higher efficiency in better channel conditions).
•Bit Rate for a Bandwidth of 2 MHz:
Spectral efficiency (η) is given by: η=
Rearranging for bit rate: Bit rate=η×Bandwidth
Substituting η=3 bps/Hz and Bandwidth=2 MHz : Bit rate=3×2×=6
Mbps

You might also like