Exp-7 PCM
Exp-7 PCM
Aim:
Theory:
Pulse Code Modulation (PCM) is a widely used technique for sampling, quantization, and
encoding analog signals into digital form.
Sampling: In PCM, the analog signal is first sampled at regular intervals to obtain discrete-
samples. The sampling rate must be chosen carefully according to the Nyquist theorem to
avoid aliasing, which states that the sampling frequency must be at least twice the maximum
frequency component of the analog signal.
In other words, it involves mapping the continuous range of amplitudes to a finite number of
levels. Each level represents a specific digital code. The number of levels determines the
resolution of quantization and is often expressed in bits (e.g., 8-bit quantization, 16-bit
quantization).
Quantization introduces quantization error, which can affect the fidelity of the reconstructed
signal.
Encoding: Encoding involves representing the quantized samples using digital codes,
typically in binary format. The most common encoding technique is pulse code modulation
(PCM), where each quantized sample is represented by a binary number.
In PCM, the amplitude of each sample determines the digital code assigned to it.
Algorithm:
Program:
% pulse code modulation
%PCM Transmitter
% Analog signal generation (sinusoidal signal)
f = 2;
fs = 20*f;
t = 0:1/fs:1;
a=2;
x=a*sin(2*pi*f*t);
%level shifting
x1 =x+a
%Quantization
q_op = round(x1)
%PCM receiver
deco= bi2de (enco, 'left-msb')
%plotting
plot(t, x, 'r-' , t, xr, 'k+-');
xlabel('time');
ylabel('amplitude');
legend('original signal', 'Reconstructed signal');
Output:
Result: