Index
Index
Experiment 1
Theory:
The transmission of digital signals is increasing at a rapid rate. Low-
frequency analog signals are often converted to digital format (PAM) before
transmission. The source signals are generally referred to as baseband signals. We
can send analog and digital signals directly over a medium. From electro-magnetic
theory, for efficient radiation of electrical energy from an antenna it must be at
least in the order of magnitude of a wavelength in size; c = fλ, where c is the
velocity of light, f is the signal frequency and λ is the wavelength. For a 1kHz
audio signal, the wavelength is 300 km. An antenna of this size is not practical for
efficient transmission. The low-frequency signal is often frequency-translated to a
higher frequency range for efficient transmission. The process is called
EXPERIMENT - 2
PHASE SHIFT KEYING GENERATION AND DETECTION
AIM: To study Phase Shift Keying generation and detection.
COMPONENTS REQUIRED: Transistor SL100, resistor, capacitor, OP Amp µA 741, signal
generator, diode.
THEORY: Phase shift keying is the digital modulation technique in which the phase of the
carrier signal is changed by varying the sine and cosine inputs at a particular time. PSK
technique is widely used for wireless LANs, bio-metric, contactless operations, along with RFID
and Bluetooth communications. PSK uses a finite number of phases, each assigned a unique
pattern of binary digits.
CIRCUIT DIAGRAM:
PSK MODULATOR:
PSK DEMODULATOR:
PROCEDURE:
WAVEFORMS:
RESULT:
EXPERIMENT - 3
FREQUENCY SHIFT KEYING GENERATION AND DETECTION
APPARATUS: Transistor SL100 and SK100, resistors, capacitors, op amp μA 741, 0A79 diode,
Power supply, CRO.
CIRCUIT DIAGRAM:
FSK MODULATOR:
DESIGN:
Ic = 2.5mA
VRE = 2.5V
FSK DEMODULATOR:
C= 0.1µF
R = 15.9KΩ
fm = 100Hz
fc1 = 1 / 2 R1C1
fc1=1 kHz R1
= 1.59 KΩ
C1= 0.1µF
PROCEDURE:
Modulation:
Demodulation:
1. Rig up the circuit as shown in figure 2 (d).
2. Feed the FSK input fromthe FSK modulator output to the OPAMP peak detector.
3. Adjust the reference voltage suitably (between 0 to 1 Volt) to get an undistorted
demodulated output. Compare it with the data input used in modulation. Record all the
waveforms as observed
WAVE FORMS:
t
t
Modulated waveform
Demodulated waveform
RESULT:
EXPERIMENT – 4
AIM: To conduct an experiment to generate DPSK signal and also design a circuit to
demodulate it.
.
CIRCUIT DIAGRAM:
PROCEDURE:
1. Refer the block diagram and carry out the following connections and switch settings.
2. Connect the power supply in proper polarity to the bit ADCL-0 I and switch to UN.
3. Select data pattern of simulated data using switch 1.
4. Connect SDAT A generator to DATA JN of differential encoder.
5. Connect NRZ-L data output to DATA JN of differential encoder.
6. Connect the north generator to S-CLK to CLK IN of the differential encoder.
7. Connect differentially encoded data to control input C 1 at carrier modulator.
12. Connect output of delay section. B(t-Tb) out of the input b(t-Tb) In of decision
device.
13. Compare the DPSK decoded data at data out with respect to Input SDA TA
14. Input NRZ-L data in differential encoder.
15. Connect carrier components SIN 1 to IN 1 of carrier modulator.
16. Connect carrier components SIN2 to IN2 of carrier modulator.
17. Connect DPSK modulated signal MO DO UT to MODIN of BPSK demodulator.
18. Connect output of BPSK demodulator b(t) out to input of delay section b(t)
and input b(t)IN of decision device.
Experiment 5
Aim: WAP in Matlab for QPSK Modulation and Demodulation
Theory :The Quadrature Phase Shift Keying (QPSK) is a variation of BPSK, and it is also
a Double Side Band Suppressed Carrier (DSBSC) modulation scheme, which sends two bits
of digital information at a time, called as bigits.
Instead of the conversion of digital bits into a series of digital stream, it converts them into bit
pairs. This decreases the data bit rate to half, which allows space for the other users.
QPSK Modulator.
The QPSK Modulator uses a bit-splitter, two multipliers with local oscillator, a 2-bit serial to
parallel converter, and a summer circuit. Following is the block diagram for the same.
At the modulator’s input, the message signal’s even bits (i.e., 2nd bit, 4th bit, 6th bit, etc.) and
odd bits (i.e., 1st bit, 3rd bit, 5th bit, etc.) are separated by the bits splitter and are multiplied
with the same carrier to generate odd BPSK (called as PSKI) and even BPSK (called
as PSKQ). The PSKQ signal is anyhow phase shifted by 90° before being modulated.
The QPSK waveform for two-bits input is as follows, which shows the modulated result for
different instances of binary inputs.
QPSK Demodulator
The QPSK Demodulator uses two product demodulator circuits with local oscillator, two band
pass filters, two integrator circuits, and a 2-bit parallel to serial converter. Following is the
diagram for the same.
The two product detectors at the input of demodulator simultaneously demodulate the two
BPSK signals. The pair of bits are recovered here from the original data. These signals after
processing, are passed to the parallel to serial converter.
Program :
% Parameters
M = 4; % QPSK has 4 symbols (2 bits per symbol, log2(4) = 2 bits)
k = log2(M); % Bits per symbol
numSymbols = 1000; % Number of symbols to transmit
% Reshape data into pairs of bits (each QPSK symbol corresponds to 2 bits)
dataInMatrix = reshape(dataIn, length(dataIn)/k, k);
Experiment 6
Aim:Write a program for 16-QAM Modulation and Constellation Diagram
Theory :
16-QAM is a type of Quadrature Modulation (QAM) in which a carrier wave of a fixed
frequency can exist in one of sixteen different states. This can be represented in a
constellation diagram (Figure 1) where each state is a symbol that contains one of 16 different
amplitude and phase levels. The constellation plot consists of two axis namely the in-phase
(X-axis) and quadrature (Y-axis) where the two axes are orthogonal to each other i.e. they are
separated by a phase of 90˚ from each other.Each symbol in the constellation contains up to 4
bits (0s and 1s) in a 16-QAM scheme. Therefore, the number of combinations that are
possible using 4 binary bits is 24 = 16, with each state or symbol containing a value from
0000 to 1111.The below figure shows waveforms for four-bit symbols with each symbol
containing a unique amplitude and phase level. For example, symbol 0000 and 0001 contains
equal amplitude but different phase levels. Hence, they are separated in the quadrature axis.
Similarly, two symbols 1001 and 1101 contain the same phase level but different amplitude
levels. Therefore, they will be separated in the in-phase axis to allow distinction between the
two.
Dept.of ECE,HKBKCE Page 17
Fig :Waveforms for all 16 combinations of symbols in 16-QAM
Digital Communication Lab BECL504
Program :
% Define the number of bits per symbol for 16-QAM (log2(16) = 4 bits/symbol)
M = 16; % 16-QAM
k = log2(M); % Number of bits per symbol
Experiment 7
Aim : Binary Baseband Signaling Simulation with Rectangular Pulse and BER Estimation
Theory :
Program:
% Parameters
N = 10000; % Number of bits to transmit
bitRate = 1e6; % Bit rate (bits per second)
fs = 10 * bitRate; % Sampling frequency (10 times the bit rate)
Tb = 1/bitRate; % Bit duration
time = 0:1/fs:Tb-1/fs; % Time vector for one bit duration
pulse = ones(1, length(time)); % Rectangular pulse shape (amplitude = 1)
% Upsample the baseband signal (expand each bit to match the pulse duration)
upsampledSignal = zeros(1, N * length(time));
for i = 1:N
upsampledSignal((i-1)*length(time)+1:i*length(time)) = basebandSignal(i) * pulse;
end
BER = numErrors / N;
% Display Results
% Plot the baseband signal, noisy received signal, and filtered signal
figure;
subplot(3,1,1);
plot(upsampledSignal(1:1000));
title('Transmitted Baseband Signal');
xlabel('Sample Index');
ylabel('Amplitude');
subplot(3,1,2);
plot(rxSignal(1:1000));
title('Received Signal with AWGN');
xlabel('Sample Index');
Dept.of ECE,HKBKCE Page 21
ylabel('Amplitude');
Digital Communication Lab BECL504
subplot(3,1,3);
plot(filteredSignal(1:1000));
title('Matched Filter Output');
xlabel('Sample Index');
ylabel('Amplitude');
Output:
Experiment 8
Aim: WAP in matlab for Gram-Schmidt Orthogonalization and Orthonormalization
Theory :
Step-by-Step Procedure:
Input:
A set of n linearly independent vectors {v1, v2, ..., vn}.
Output:
An orthogonal set of vectors {u1, u2, ..., un}. Optionally, an orthonormal set {e1, e2, ..., en}.
Procedure:
1. Initialization:
- Begin with the first vector v1.
- Assign u1 = v1.
2. Orthogonalization:
- For each subsequent vector vk (where k = 2, 3, ..., n):
Subtract the projection of vk onto each of the already orthogonalized vectors u1, u2, ..., uk-
1:
uk = vk - ∑ proj_ui(vk),
3. Normalization (Optional):
- If an orthonormal set is required, normalize each orthogonal vector uk to unit length:
ek = uk / ||uk||,
Example:
Given Vectors:
v1 = [1, 1, 0], v2 = [1, 0, 1], v3 = [0, 1, 1].
1. u1 = v1 = [1, 1, 0].
3. Compute u3:
Subtract projections onto both u1 and u2.
Program :
% Subtract the projection of the current vector onto all previous orthogonal vectors
for j = 1:i-1
v = v - (dot(Q(:,j), A(:,i)) / dot(Q(:,j), Q(:,j))) * Q(:,j);
end
zlabel('Z');
view(3); % 3D view
hold off;
Output:
Experiment 9
Huffman coding
Aim: WAP in Matalab for Huffman coding
Theory :
Huffman Coding is a lossless data compression algorithm that efficiently reduces the size of
data by assigning variable-length binary codes to symbols. It is based on the principle of using
shorter codes for more frequent symbols and longer codes for less frequent symbols. This
method minimizes the total number of bits required to encode a given dataset while ensuring
Dept.of ECE,HKBKCE Page 27
no loss of information.
Digital Communication Lab BECL504
Concepts:
1. Lossless Compression:
o No data is lost during compression, and the original data can be perfectly
reconstructed.
2. Variable-Length Codes:
o Frequently occurring symbols are assigned shorter binary codes.
o Rare symbols are assigned longer binary codes.
3. Prefix-Free Codes:
o Huffman codes are designed so that no code is a prefix of another, allowing
unambiguous decoding.
Algorithm:
Huffman Encoding:
Program :
x = input('Enter the number of symbols: '); N = 1:x;
disp('The number of symbols are N:'); disp(N);
for i = 1:x
1 2 3 4
Enter the probabilities (as a vector of size x): [0.1 0.2 0.3 0.4]
The probabilities are P:
0.1000 0.2000 0.3000 0.4000
The sorted probabilities are:
0.4000 0.3000 0.2000 0.1000
The average length of the code is: 1.9000
Entropy is:
1.8464
bits/msg Efficiency
is:
97.1810
The codewords are:
0 0 1 0 0 0 0 1 1
The decoded output:
1 2 3 4
Experiment 10
Hamming Coding
Aim: WAP for Hamming code
Theory:
In coding theory, Hamming(7,4) is a linear error-correcting code that encodes four bits of data
into seven bits by adding three parity bits.
The Hamming code adds three additional check bits to every four data bits of the message.
Dept.of ECE,HKBKCE Page 30
Hamming's (7,4) algorithm can correct any single-bit error, or detect all single-bit and two-bit
errors. In other words, the minimal Hamming distance between any two correct codewords is 3,
Digital Communication Lab BECL504
and received words can be correctly decoded if they are at a distance of at most one from the
codeword that was transmitted by the sender. This means that for transmission medium
situations where burst errors do not occur, Hamming's (7,4) code is effective (as the medium
would have to be extremely noisy for two out of seven bits to be flipped).
Program:
clear;
n = 7; % Number of codeword bits per block
k = 4; % Number of message bits per block
% Generator matrix
G = [eye(k) A];
% Parity-check matrix
H = [A' eye(n-k)];
% ENCODER
msg = [1 0 1 1]; % Message block vector (change to any 4-bit sequence)
% Encode message
code = mod(msg * G, 2);
% CHANNEL ERROR (Uncomment one line to simulate an error at a specific position)
code(1) = ~code(1);
% code(2)
Dept.of = ~code(2);
ECE,HKBKCE Page 31
% code(3) = ~code(3);
Digital Communication Lab BECL504
% code(4) = ~code(4);
% code(5) = ~code(5);
% code(6) = ~code(6);
% code(7) = ~code(7);
% DECODER
syndrome = mod(recd * H', 2);
if found
disp(['Position
Dept.of ECE,HKBKCEof error in codeword = ', num2str(index)]); Page 32
correctedcode = recd;
correctedcode(index) = mod(recd(index) + 1, 2); % Corrected codeword
else
disp('No error detected.');
correctedcode = recd;
end
disp(msg);
disp('Encoded Codeword:');
disp(code);
disp('Received Codeword with Error:');
disp(recd);
disp('Corrected Codeword:');
disp(correctedcode);
disp('Decoded Message:');
disp(msg_decoded);
output:
>> hamming
Position of error in codeword = 1
Original Message:
1 0 1 1
Encoded Codeword:
0 0 1 1 0 0 1
1 0 1 1 0 0 1
Decoded Message:
1 0 1 1
Experiment 11
Convolution Coding
Dept.of
Aim: ECE,HKBKCE
WAP to conduct convolution program in Matlab Page 34
Digital Communication Lab BECL504
Program:
clc;
close
all;
clear
all;
k=3;
G1=7;
% First sequence
polynomial% G2=5;
% Second sequence
polynomial% msg=[1 0 1 1 ];
trel=poly2trellis(k,[G1
G2]); disp('message
sequence :');
disp(msg);
coded=convenc(msg,trel);
disp('encoder output :');
disp(coded);
tblen=length(msg);
decoded=vitdec(coded,trel,tblen,'trunc','hard')
; disp('encoder output :');
disp(decoded);
Dept.of ECE,HKBKCE Page 35
output:
message sequence :
Digital Communication Lab BECL504
1 0 1 1 0
encoder output :
Columns 1 through 9
1 1 1 0 0 0 0 1 0
Column 10
1
encoder output :
1 0 1 1 0
>>
Experiment 12
o Data Verification:
1. At the receiver, divide the received data (original data + checksum) by
the same generator polynomial.
Dept.of ECE,HKBKCE
2. If the remainder is zero, the data is error-free; otherwise, it has errors.
Page 37
4. Error Detection Capability:
Digital Communication Lab BECL504
o CRC-8, CRC-16, CRC-32, and CRC-64, where the numbers indicate the length
of the checksum in bits.
o CRC-32 is commonly used in network protocols like Ethernet and ZIP files.
Advantages of CRC:
Efficiency: Fast computation using XOR and shift operations.
High Accuracy: Reliable in detecting most common errors, including burst errors.
Simplicity: Easy to implement in hardware or software.
Applications:
Data communication protocols (e.g., Ethernet, USB, HDLC).
File formats (e.g., ZIP, PNG).
Program :
function crc_ccitt_example()
% Polynomial for CRC-CCITT (x^16 + x^12 + x^5 + 1)
poly = [1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1]; % CRC-CCITT polynomial in binary
disp('Original
Message:');
disp(msg);
% Append zeros for CRC
Dept.of ECE,HKBKCE Page 38
calculation data = [msg zeros(1,
length(poly) - 1)];
Digital Communication Lab BECL504
% Calculate CRC
crc = calculate_crc(data, poly);
disp('CRC Code:');
disp(crc);
poly);
end
function verify_crc(codeword, poly)
% Perform CRC check by calculating the
remainder remainder =
calculate_crc(codeword, poly);
disp('Remainder:');
disp(remainder);
if all(remainder == 0)
disp('No error detected. The codeword is valid.');
else
disp('Error detected in the
codeword.');
end ECE,HKBKCE
Dept.of Page 40
end
Digital Communication Lab BECL504
>> crc
ccitt_example
Original
Message:
1 0 1 0 1 1 0 1
CRC Code:
Columns 1 through 9
0 1 1 0 0 1 0 1 1
Columns 10 through 15
0 1 0 1 1 1
Transmitted Codeword:
Columns 1 through 9
1 0 1 0 1 1 0 1 0
Columns 10 through 18
1 1 0 0 1 0 1 1 0
Columns
Dept.of 19 through 23
ECE,HKBKCE Page 41
Digital Communication Lab BECL504
1 0 1 1 1
Columns 1 through 9
0 0 0 0 0 0 0 0 0
Columns 10 through 15
0 0 0 0 0 0
1 0 0 0 1 1 0 1 0
Columns 10 through 18
1 1 0 0 1 0 1 1 0
1 0 1 1 1
Remainder:
Columns 1 through 9
0 0 1 0 0 1 0 0 0
Columns 10 through 15
0 0 0 0 1 0
The end