Exp 5 by Me Part 1
Exp 5 by Me Part 1
1 Experiment No : 05
5.2 Experiment Name: Study and Observation of Pulse Code Modulation (PCM).
5.3 Objectives:
✓ To learn about Pulse Code Modulation (PCM)
✓ To perform PCM modulator and demodulator
✓ To understand Digital Signal Representation.
✓ To Explore Signal Fidelity and Compression and bandwidth requirements.
✓ To study Error Detection, Signal Quantization Noise and SNR .
5.4 Theory :
Pulse Code Modulation (PCM) is a digital scheme widely used in telecommunications to
represent analog signals. It is the format that is typically used for digital audio in computers,
compact discs, digital phones, and other devices. Pulse Code Modulation (PCM) is a digital
scheme widely used in telecommunications to represent analog signals. In PCM, the analog
signal (such as a voice signal) is first sampled at regular intervals according to the Nyquist rate,
then quantized into discrete values, and finally encoded into a binary format for digital
transmission. A PCM stream quantizes each sample to the closest value within a range of digital
steps after routinely sampling the analog signal's amplitude at uniform intervals. Thus, two
important PCM phenomena are sampling and quantizing.
Sampling is the process of creating pulses with the same instantaneous amplitude as the analog
signal but with zero width. The sampling rate is defined as the number of pulses per second.
Quantization is the process of dividing the maximum value of the analog signal into a fixed no.
of levels in order to convert the PAM into a Binary Code. The levels obtained are called
“quantization levels”.
PCM is favored in telecommunications for its simplicity, reliability, and high-quality signal
representation. It provides a robust and efficient method for transmitting voice and other analog
data over digital channels, minimizing noise and distortion compared to analog transmission
methods. Additionally, PCM allows for easy integration with other digital communication
systems and facilitates multiplexing, error detection, and correction techniques to enhance the
overall quality and efficiency of the communication process.
5.5 MATLAB Code & Output Wave for PCM:
1 % Pulse Code Modulation(PCM)
2
3 Fs = input('Enter Sampling frequency (Hz)');
4 f = input('Enter Frequency of the sinusoid (Hz)');
5 A = input('Enter Amplitude of the sinusoid');
6 nBits = input('Enter no. of bits for quantization');
7 t = 0:1/Fs:1-1/Fs;
8 x = input(' Generate a sinusoidal signal');
9 x_norm = (x + A) / (2 * A);
10 x_quantized = round(x_norm * (2^nBits - 1));
11 x_quantized_norm = x_quantized / (2^nBits - 1);
12 x_reconstructed = (x_quantized_norm * 2 * A) - A;
13
14 figure;
15
16 subplot(3, 1, 1);
17 plot(t, x);
18 title('Original Signal');
19 xlabel('Time (s)');
20 ylabel('Amplitude');
21
22 subplot(3, 1, 2);
23 stem(t, x_quantized, 'filled');
24 title('Quantized Signal (Analog to Digital)');
25 xlabel('Time (s)');
26 ylabel('Quantized Level');
27
28 subplot(3, 1, 3);
29 plot(t, x_reconstructed);
30 title('Reconstructed Signal from PCM');
31 xlabel('Time (s)');
32 ylabel('Amplitude');