DC 1
DC 1
DC 1
Experiment -1
ASK GENERATION AND DETECTION
AIM: Design & Demonstrate an ASK system to transmit digital data using a suitable
carrier. Demodulate the signal with suitable circuit.
THEOREY:
Any digital modulation scheme uses a finite number of distinct signals to represent digital
data. ASK uses a finite number of amplitudes, each assigned a unique pattern of binary
digits. Usually, each amplitude encodes an equal number of bits. Each pattern of bits
forms the symbol that is represented by the particular amplitude. The demodulator, which
is designed specifically for the symbol-set used by the modulator, determines the
amplitude of the received signal and maps it back to the symbol it represents, thus
recovering the original data. Frequency and phase of the carrier are kept constant.
DESIGN:
Assume Icsat = 5mA , hfe(min) = 20 , VCEsat = 0.2V , VBE = 0.7V
IB = IC / hfe =____mA
DETECTION:
PROCEDURE:
2. Provide message signal m(t) and carrier signal c(t) using signal generator.
3. Observe the ASK signal at the Emitter and note down the readings i.e Voltage & Time
period.
4. Connect the detection circuit as shown and supply the ASK signal
5. Carefully vary Vref and observe the detected signal, note down its voltage level and
time period.
WAVE FORMS
Faculty Signature:
Experiment - 2
PSK GENERATION AND DETECTION
AIM: Design & demonstrate a PSK system to transmit digital data using a suitable carrier.
APPARATUS: IC CD-4051, LM-741IC, Function generator, OA79 Diode, RPS, CRO, CRO Probes,
Connecting wires.
Theory :
BPSK or PRK (Phase Reversal Keying) is the simplest form of PSK. It uses two phases which are
separated by 180 and so can also be termed as 2-PSK. It is however only able to modulate 1
bit/symbol and so it is unsuitable for high data-rate applications when bandwidth is limited. Phase shift
keying is one of the most efficient digital modulation techniques. It is used for very high bit rates. In
PSK, the phase of the carrier is modulated to represent Binary values. In BPSK, the carrier phase is
used to switch the phase between 00 and 1800 by digital polar format. Hence it is also known as phase
reversal keying.
The modulated carrier is given by: Binary 1: S (t) = Ac max. Cos. (2πfct)
The information about the bit stream is contained in the changes of phase of the transmitted signal. A
synchronous demodulator would be sensitive to these phase reversals. The appearance of a BPSK signal in the
time domain is shown in Figure 2 (lower trace). The upper trace is the binary message sequence.
There is something special about the waveform of Figure 2. The wave shape is 'symmetrical' at each phase
transition. This is because the bit rate is a sub-multiple of the carrier frequency w / (2p). In addition, the
message transitions have been timed to occur at a zero-crossing of the carrier. Whilst this is referred to as
'special', it is not uncommon in practice. It offers the advantage of simplifying the bit clock recovery from a
received signal. Once the carrier has been acquired then the bit clock can be derived by division.
BPSK Demodulation: Demodulation of a BPSK signal can be considered a two-stage process. Translation
back to baseband, with recovery of the band limited message waveform Regeneration from the bandlimited
waveform back to the binary message bit stream. Translation back to baseband requires a local, synchronized
carrier.
Stage 1
Translation back to baseband is achieved with a synchronous demodulator, as shown in Figure 3 below. This
requires a local synchronous carrier. In this experiment a stolen carrier will be used.
Stage 2
The translation process does not reproduce the original binary sequence, but a band limited version of it. The
original binary sequence can be regenerated with a detector. This requires information regarding the bit clock
rate. If the bit rate is a sub-multiple of the carrier frequency then bit clock regeneration is simplified.
Detection:
DESIGN:
a. Generation
Inverting Amp: c'(t) = - ( ) c (t) let |gain|=1 so RF=R1 (say 1kΩ)
b. Detection
Adder: v(t) = - ( )[fsk + c1'(t)] let |gain| =1 so Rf=R1(say 1kΩ)
Envelope detector :
1/fc < RC < 1/fm
Let C = 0.47μf RC>>Tc; RC = 10 Tc; R ~ 10 KΏ pot
Using modulation index RC can be calculated as follows:
1 /RC ≥Wmµ / (1- µ2)1/2
PROCEDURE:
1. Connections are made as shown in circuit diagram
2. Provide message signal m(t) and carrier signal c(t) using signal generator
3. Observe the BPSK signal at the pin 3 of IC CD4051 and Trace it on to Linear graph sheet from
CRO Also trace inversion of C(t).
4. Connect the detection circuit as shown and supply the BPSK signal and c(t).
5. Vary Vref carefully, observe the intermediate ASK signal and detected signal, Trace them on
to Linear graph sheet from CRO.
Faculty Signature:
Experiment -3
FSK GENERATION AND DETECTION
AIM: Design & Demonstrate an FSK system to transmit digital data using a suitable carrier and
demodulate the signal with suitable circuit.
APPARATUS: IC CD-4051, LM-741IC, Function generator, OA79 Diode, RPS, CRO, CRO
Probes, Connecting wires.
Theory:
Frequency Shift Keying
It is defined as the changing or improving the frequency characteristics of an input binary
signal according to the carrier signal. Amplitude variation is one of the major drawbacks
in ASK. So, due to this ask modulation technique used in a few applications only. And its
spectrum power efficiency also low. It leads to wastage of power. So to overcome these
drawbacks Frequency Shift Keying is preferred. FSK is also known as Binary Frequency
Shift Keying (BFSK). The below frequency shift keying theory describes what happening
in frequency shift keying modulation.
This frequency shift keying theory shows how the frequency characteristics of a binary
signal changed according to the carrier signal. In FSK, the binary information can be
transmitted through a carrier signal along with frequency changes. The below diagram
shows the frequency shift keying block diagram.
In FSK, two carrier signals are used to produce FSK modulated waveforms. The reason
behind this, FSK modulated signals are represented in terms of two different frequencies.
The frequencies are called “mark frequency” and “space-frequency”. Mark frequency has
represented logic 1 and space-frequency has represented the logic 0. There is only one
difference between these two carrier signals, i.e. carrier input 1 having more frequency
than the carrier input 2.
The switch (s) of the 2:1 multiplexer is having the important role to generate the FSK
output. Here the switch is connected to carrier input 1 for all logic 1’s of the binary input
sequence. And switch (s) is connected to carrier input 2 for all logic 0’s of the input
binary sequence. So, the resultant FSK modulated waveforms have mark frequencies and
space
frequencies.
FSK-modulation-output-waveforms
Now we will see how the FSK modulated wave can be demodulated at the receiver side.
Demodulation is defined as reconstructing the original signal from the modulated signal.
This demodulation can be possible in two ways. They are
The only difference between the coherent and non-coherent way of detection is the phase
of the carrier signal. If the carrier signal we are using at the transmitter side and receiver
side are in the same phase while demodulation process i.e. called a coherent way of
detection and it is also known as synchronous detection. If the carrier signals which we
are using at transmitter and receiver side
Are not in the same phase then such modulation process known as Non-coherent
detection. Another name for this detection is Asynchronous detection.
In this synchronous FSK detection, the modulated wave got affected by noise while
reaching the receiver. So, this noise can be eliminated from using the bandpass filter
(BPF). Here at multiplier stage, the noisy FSK modulated signal is multiplied with the
carrier signal from the local oscillator device. Then the resultant signal passes from the
BPF. Here this bandpass filter is assigned to cut off frequency which is equal to the
binary input signal frequency. So the same frequencies can be allowed to the decision
device. Here this decision device gives 0 and 1 for space and mark frequencies of the
FSK modulated waveforms.
Coherent-FSK-detection
The modulated FSK signal is forwarded from the bandpass filter 1 and 2 with cut off
frequencies equals to space and mark frequencies. So, the unwanted signal components
can be eliminated from the BPF. And the modified FSK signals are applied as input to the
two envelop detectors. This envelope detector is a circuit having a diode (D). Based upon
the input to the envelope detector it delivers the output signal. This envelope detector
used in the amplitude demodulation process. Based upon its input it generates the signal
and then it is forwarded to the threshold device. This threshold device gives the logic 1
and 0 for the different frequencies. This would be equal to the original binary input
sequence. So, the FSK generation and detection can be done in this way. This process can
be known for the frequency-shift keying modulation and demodulation experiment also.
In this FSK experiment, FSK can be generated by the 555 timer IC and detection can be
possible by 565IC which is known as a phase-locked loop (PLL).
Non-coherent-FSK-detection
There are few frequency shift keying advantages and disadvantages are listed below.
Advantages
Disadvantages
It requires more bandwidth than the ASK and PSK(phase shift keying)
Due to the requirement of large bandwidth, this FSK has limitations to use only in
low-speed modems which the bit rate is 1200bits/sec.
The bit error rate is less in AEGN channel than phase shift keying.
Thus, the frequency shift keying is one of the fine digital modulation technique to
increase the frequency characteristics of the input binary signal. By FSK modulation
technique we can achieve error-free communication in a few digital applications. But this
FSK has finite data rate and consumes more bandwidth can be overcome by the QAM,
which is known as quadrature amplitude modulation. It is the combination of amplitude
modulation and phase modulation.
Circuit Diagram:
Generation:
DETECTION:
DESIGN :
a) Generation
Assume bit duration of message, Tb = 1ms.
fc= n/Tb
Assume Tb = 1ms, n = 2 and fc = 2KHz.
f1 = (n+1)fc, f2 = (n+2)fc
= 3KHz = 4KHz
PROCEDURE:
Connections are made as shown in circuit diagram
Provide message signal m(t) and carrier signals C1(t) and C2(t)using signal generator
Observe the FSK signal at the pin 3 of IC CD4051 and Trace it on to Linear graph sheet from
CRO. Also trace m(t), C1(t), C2(t).
Connect the detection circuit as shown and supply the FSK signal and C1(t)
Carefully vary Vref, observe the intermediate ASK signal and detected signal, Trace them on to
Linear graph sheet from CRO
Faculty Signature:
Experiment - 4
DPSK Transmitter and Receiver
Aim: To study the various steps involved in generating differential phase shift keyed signal at the
modulator end and recovering the binary signal from the received DPSK signal.
Apparatus:
1. Differential Phase Shift Keying Trainer
2. CRO
3. Connecting Wires
Theory: DPSK may be viewed as the non-coherent version of PSK. It eliminates the need for a
coherent reference signal at the receiver by combining two basic operations at the transmitter:
1. Differential encoding of the input binary wave and
2. Phase-Shift Keying hence, the name, differential phase shift keying (DPSK).
In effect to send symbol 0, we phase advance the current signal wave-form by 1800, and to send
symbol 1, we leave the phase of the current signal waveform unchanged. The receiver is equipped
with a storage capability, so that it can measure the relative phase difference between the
waveforms received during two successive bit intervals. Provided that the unknown phase θ
contained in thereceived wave varies slowly, the phase difference between wave forms received in
two successive bit intervals will be independent of θ.
The block diagram of a DPSK transmitter is shown in fig.1 below. It consists, in part of a logic
network and a one-bit delay element interconnected so as to convert the binary sequence {b k} into a
differentially encoded sequence {d k}. This sequence is amplitude level encoded and then used to
modulate a carrier wave of frequency fc, thereby producing the desired DPSK signal.
The optimum receiver for differentially coherent detection of binary DPSK is as shown in fig.2
below. This implementation merely requires that sample values be stored, thereby avoiding the
need for delay lines that may be needed otherwise. The equivalent receiver implementation that
tests squared elements is more complicated, but its use makes the analysis easier to handle in
that the two signals to be considered are orthogonal.
system. The square wave generated by 8038 IC is at +/_ 12v level. So this is converted into a
+5v signal . The differential signal to the modulating signal is generated using an exclusive-
OR gate and a 1-bit delay circuit.CD 4051 is an analog multiplexer to which carrier is applied
with and without 180 degrees phase shift(created by using an operational amplifier connected
in inverting amplifier mode) to the two inputs of the IC741.
Differential signal generated by EX-NOR gate (IC CD4077) is given to the multiplexers control
signal input. Depending upon the level of the control signal, carrier signal applied with or without
phase shift is steered to the output. One-bit delay generation of differential signal to the input is
created by using a D-flip-flop (IC 7474). During the demodulation, the DPSK signal is converted
into a +5v square wave signal using a transistor and is applied to one input of an EX-NOR gate.
To the second input of the gate, carrier signal is applied after conversion into a +5v signal. So the,
EX-NOR gate output is equivalent to the differential signal of the modulating data. This
differential data is applied to the one input of an Exclusive-NOR gate and to the second input,
after one-bit delay the same signal is given. So the output of this EX-NOR gate is modulating
signal.
Fig 3. DPSK Modulator and demodulator with EX-NOR Differential encoder and decoder
Procedure:
Expected Waveform
Fig 4. Connection Diagram of DPSK Modulator and demodulator with EX-OR Differential encoder
and decoder
Procedure:
Faculty Signature:
Theory: Gram-Schmidt orthogonalization process is a method used in linear algebra to convert a set
of vectors into an orthogonal (perpendicular) set of vectors, while preserving the original span. Once
the vectors are orthogonal, they can be further normalized to produce an orthonormal set, meaning
the vectors are both perpendicular and have a unit length (magnitude = 1).
Code:
close all;
clc;
clear all;
Output 1:
Enter the number of vectors:3
Enter the dimension of each vector: 3
Enter vector 1 as [x y z]: [1 2 3]
Enter vector 2 as [x y z]: [1 1 0]
Enter vector 3 as [x y z]: [0 1 1]
Original Vectors:
1 1 0
2 1 1
3 0 1
Orthonormal Vectors:
0.2673 0.6745 -0.6882
0.5345 0.4905 0.6882
0.8018 -0.5518 -0.2294
Output 2:
Original Vectors:
1 1 0
1 0 1
0 1 1
Orthonormal Vectors:
0.7071 0.4082 -0.5774
0.7071 -0.4082 0.5774
0 0.8165 0.5774
3D View
7.
Conclusion / Inference: (To be written by students)
Faculty Signature:
Experiment - 6
Simulation of Binary Basedand Signals using Rectangular Pulse and Estimation
the BER for AWGN channel using Matched Filter Receiver
Aim: Simulation of binary baseband signals using a rectangular pulse and estimate the Bit Error Rate
for Additive White Gaussian Noise channel using matched filter receiver
Theory: Digital communication is the transmission of information using discrete (digital) signals,
which offers several advantages over analog communication, including improved noise resilience and
efficient use of bandwidth. In digital communication systems, binary data is encoded and transmitted
over various channels, with the quality of reception being critically impacted by noise and interference.
Baseband transmission refers to the direct transmission of digital signals without any modulation to
higher frequencies. Pulse shaping is a crucial technique in digital communication to control the
spectral properties of the transmitted signal and reduce intersymbol interference (ISI). AWGN is a
model used to represent the impact of random noise on communication channels. It is characterized by
having a constant power spectral density and is additive in nature. The noise is normally distributed
with zero mean, significantly affecting the received signal's quality. The Bit Error Rate (BER)
quantifies the performance of a digital communication system by measuring the proportion of
transmitted bits that are incorrectly received. So a matched filter is a fundamental receiver design that
optimally processes signals received in the presence of noise. The filter is designed to maximize the
signal-to-noise ratio (SNR) at the time of sampling. For a rectangular pulse, the matched filter has the
same shape as the pulse itself. Its output is sampled at the symbol rate to make a decision on the
received bits:
clear all;
close all;
clc;
% Parameters
N = 1e5; % Number of bits
Eb_N0_dB = -10:2:10; % Eb/N0 in dB
Fs = 10; % Sampling frequency (samples per symbol)
pulse_duration = 1; % Duration of rectangular pulse (in symbol periods)
for i = 1:length(Eb_N0_dB)
% AWGN Channel (Eb/N0 -> SNR conversion)
Eb_N0 = 10^(Eb_N0_dB(i)/10);
noise_var = 1/(2*Eb_N0); % Noise variance
noise = sqrt(noise_var) * randn(1, length(signal_tx)); % AWGN
% Compute BER
errors = sum(data ~= data_rx);
BER(i) = errors / N; % Compare transmitted and received bits
% Debugging output
fprintf('Eb/N0: %d, Errors: %d, BER: %f\n', Eb_N0_dB(i), errors, BER(i));
end
Output1:
Eb/N0: -10, Errors: 29265, BER: 0.292650
Eb/N0: -8, Errors: 27053, BER: 0.270530
Eb/N0: -6, Errors: 25786, BER: 0.257860
Eb/N0: -4, Errors: 25158, BER: 0.251580
Eb/N0: -2, Errors: 24998, BER: 0.249980
Eb/N0: 0, Errors: 25108, BER: 0.251080
Eb/N0: 2, Errors: 25082, BER: 0.250820
Eb/N0: 4, Errors: 24923, BER: 0.249230
Eb/N0: 6, Errors: 25226, BER: 0.252260
Eb/N0: 8, Errors: 24986, BER: 0.249860
Eb/N0: 10, Errors: 24965, BER: 0.249650
Faculty Signature:
Experiment - 7
Perform the QPSK Modulation and demodulation and Display the signal and its
constellatioan.
Aim: Perform the QPSK Modulation and demodulation. Display the signal and its constellation
Theory: Quadrature Phase Shift Keying (QPSK) is a modulation technique that conveys two bits of information
per symbol, making it more efficient than Binary Phase Shift Keying (BPSK). QPSK utilizes four distinct phase
shifts to represent four different symbols. Each symbol corresponds to a unique pair of bits. This allows QPSK
to effectively double the data rate without increasing the bandwidth. QPSK uses two orthogonal carrier signals,
In-phase (I) and Quadrature (Q). These signals are typically sinusoidal and 90 degrees out of phase with each
other. The modulation process combines these carriers with the data to produce the QPSK signal. In QPSK, two
bits are grouped to form a symbol, leading to four possible symbols: (00, 01, 10, 11). The constellation diagram
provides a visual representation of the QPSK symbols in the I-Q plane, illustrating the relationship between the
phase shifts and the corresponding bit pairs. Each point on the constellation diagram represents a unique
symbol, and the distance between points can indicate the potential for errors in noisy conditions. Each symbol is
represented by a specific phase in the constellation diagram:
% QPSK Modulation
clc;
clear all;
close all;
for i = 1:2:(N-1)
t = [t1:(Tb/100):t2];
% QPSK Demodulation
t1 = 0;
t2 = Tb;
demod = zeros(1, N);
for i = 1:N-1
t = [t1:(Tb/100):t2];
% Correlator
x1 = sum(c1 .* qpsk_signal((i-1)*length(t)+1:i*length(t)));
x2 = sum(c2 .* qpsk_signal((i-1)*length(t)+1:i*length(t)));
% Decision device
if (x1 > 0 && x2 > 0)
demod(i) = 1;
demod(i + 1) = 1;
elseif (x1 > 0 && x2 < 0)
demod(i) = 1;
demod(i + 1) = 0;
elseif (x1 < 0 && x2 < 0)
demod(i) = 0;
demod(i + 1) = 0;
elseif (x1 < 0 && x2 > 0)
demod(i) = 0;
demod(i + 1) = 1;
end
t1 = t1 + (Tb + 0.01);
t2 = t2 + (Tb + 0.01);
end
Output:
Faculty Signature:
Experiment - 9
Generate 16-QAM Modulation and obtain the QAM constellation
Theory: QAM is a widely used method of transmitting digital data over bandpass channels. QAM is a
popular choice because of its bandwidth efficiency and its ability to compensate for linear channel
distortion. QAM combines amplitude and phase modulation to convey data effectively. 16-QAM
represents data using 16 distinct symbols, each symbol corresponds to 4 bits of information (since
2^4=16), making it suitable for high-rate data transmission. The constellation diagram visualizes these
symbols in the complex plane, where the x-axis represents the in-phase component and the y-axis
represents the quadrature component.
Code:
close all;
clear all;
clc;
% Parameters
N = 1000; % Number of bits
M = 16; % 16-QAM
k = log2(M); % Number of bits per symbol (4 for 16-QAM)
SNR = 30; % Signal-to-Noise Ratio in dB
Output1: SNR-30
Output 2: SNR- 0 dB
Faculty Signature:
Experiment - 9
Encoding and decoding of binary data using Huffman code
Aim: To write a MATLAB program to encode and decode binary data using Huffman code.
Theory:
Huffman coding is a widely used method for lossless data compression, named after David A.
Huffman who introduced it in 1952. It's a variable-length prefix coding algorithm used to compress
data, where the most frequent symbols are represented using shorter codes and the least frequent
symbols are represented using longer codes. Encoding the information before transmission is
necessary to ensure data security and efficient delivery of the information. The MATLAB program
presented here encodes and decodes the information and also outputs the values of entropy,
efficiency and frequency probabilities of characters present in the data stream.
Procedure:
PROGRAM
dict{3,:}
dict{4,:}
dict{5,:}
hcode = huffmanenco(symbol,dict);
dhsig = huffmandeco(hcode,dict); % Decode the code.
disp('encoded msg:');
disp(hcode);
disp('decoded msg:');
disp(dhsig);
code_length=length(hcode)
sum=0;
for m=1:5
H=sum+(p(m)*log2(1/p(m)));
end
disp('H=');
disp(H);
Efficiency=(H/avglen)*100
Output:
Faculty Signature:
Experiment - 10
Encoding and decoding of binary data using Hamming code
Aim: To write a MATLAB program to encode binary data using a (7,4) Hamming code
and decode it.
Theory: The (7,4) Hamming code is an error-correcting code that allows the correction
of single-bit errors and the detection of two-bit errors. It operates on 4 bits of data and
adds 3 parity bits to form a 7-bit codeword.
Let's go through the steps to encode and decode a (7,4) Hamming code:
1. Data Preparation: Let's assume we have a 4-bit data sequence (D3, D2, D1,
D0).
2. Calculate Parity Bits (P0, P1, P2):
P0 is the parity bit for bits: D0, D1, D3
P1 is the parity bit for bits: D0, D2, D3
P2 is the parity bit for bits: D1, D2, D3
3. Insert Parity Bits: Place the calculated parity bits at their respective positions
in the 7-bit codeword.
4. Form the Codeword: The codeword is now composed of the original 4 bits of
data and the 3 parity bits.
Procedure:
Let's consider a 4-bit data: 1011 (D3, D2, D1, D0).
PROGRAM
%Simulation for encoding and decoding of a [7,4] Hamming code. The decoder
%can correct one error as shown and as theory states. The table at the end
%of the file shows the various outputs with different error positions and
%message bits. One error can be placed at any of the 7 bit locations and
%corrections made.
clc;
clear all;
close all;
n = 7%# of codeword bits per block
k = 4%# of message bits per block
A = [ 1 1 1;1 1 0;1 0 1;0 1 1 ];%Parity submatrix-Need binary(decimal combination of
7,6,5,3)
G = [ eye(k) A ]%Generator matrix
H = [ A' eye(n-k) ]%Parity-check matrix
% ENCODER%
msg = [ 1 1 1 1 ] %Message block vector-change to any 4 bit sequence
code = mod(msg*G,2)%Encode message
% CHANNEL ERROR(add one error to code)%
%code(1)= ~code(1);
code(2)= ~code(2);
%code(3)= ~code(3);
%code(4)= ~code(4);%Pick one,comment out others
%code(5)= ~code(5);
%code(6)= ~code(6);
%code(7)= ~code(7);
recd = code %Received codeword with error
% DECODER%
syndrome = mod(recd * H',2)
%Find position of the error in codeword (index)
find = 0;
for ii = 1:n
if ~find
errvect = zeros(1,n);
errvect(ii) = 1;
search = mod(errvect * H',2);
if search == syndrome
find = 1;
index = ii;
end
end
end
disp(['Position of error in codeword=',num2str(index)]);
correctedcode = recd;
correctedcode(index) = mod(recd(index)+1,2)%Corrected codeword
%Strip off parity bits
msg_decoded=correctedcode;
msg_decoded=msg_decoded(1:4)
In MATLAB, the eye function is used to create an identity matrix, which is a square
matrix with ones on the main diagonal and zeros elsewhere. Where n is the number of
rows (and columns) in the resulting identity matrix.
Output
n =7
k =4
G=
1 0 0 0 1 1 1
0 1 0 0 1 1 0
0 0 1 0 1 0 1
0 0 0 1 0 1 1
H=
1 1 1 0 1 0 0
1 1 0 1 0 1 0
1 0 1 1 0 0 1
msg =
1 1 1 1
code =
1 1 1 1 1 1 1
recd =
1 0 1 1 1 1 1
syndrome =
1 1 0
correctedcode =
1 1 1 1 1 1 1
msg_decoded =
1 1 1 1
Faculty Signature:
Experiment - 11
For a given data, use CRC-CCITT polynomial to obtain the CRC code. Verify the program for
the cases a) Without error b) With error
Aim: To obtain the CRC code for a given data using CRC-CCITT polynomial and to Verify the
program for the cases a) Without error b) With error
Theory:The cyclic redundancy check, or CRC, is a technique for detecting errors in digital data,
but not for making corrections when errors are detected. It is used primarily in data
transmission. This Cyclic Redundancy Check is the most powerful and easy to implement
technique. CRC is based on binary division. In CRC, a sequence of redundant bits, called cyclic
redundancy check bits, are appended to the end of data unit so that the resulting data unit
becomes exactly divisible by a second, predetermined binary number. At the destination, the
incoming data unit is divided by the same number. If at this step there is no remainder, the data
unit is assumed to be correct and is therefore accepted. A remainder indicates that the data unit
has been damaged in transit and therefore must be rejected.The CCITT CRC-16 polynomial
(used in a variety of applications) is represented by the polynomial x16+x12+x5+1, which
corresponds to the hex value 0x1021. We'll create a ‘C’ program to generate the CRC code for a
given input data and then simulate both cases: without error and with error in the received data.
Procedure:
1. Generate CRC for the given data using the CRC-CCITT polynomial.
2. Introduce an error in the data.
3. Recalculate CRC for the erroneous data.
4. Verify if the CRC detects the error.
Program
function crc_check ()
% Step 1: Generate the CRC-CCITT code for the given bit pattern
message = input('Enter the bit pattern in binary: ', 's');
generator_polynomial = '10001000000100001'; % 17-bit generator polynomial
% Check if the received code is error-free by dividing with the generator polynomial
error = perform_crc_division(received_code, generator_polynomial);
if strcmp(error, '0000000000000000')
fprintf('Received code is error-free.\n');
else
fprintf('Received code contains an error.\n');
end
end
for i = 1:length(message) - 16
if remainder(i) == '1'
for j = 1:length(generator)
if remainder(i + j - 1) == generator(j)
remainder(i + j - 1) = '0';
else
remainder(i + j - 1) = '1';
end
end
end
end
Data to be transmitted : 1 0 1 0 1 0 1 0 0 0 0 1 0 1 0 0 1 0 1 0
Enter the received data: 1 0 1 0 1 0 1 0 0 0 0 1 0 1 0 0 1 0 1 1
ERROR in Recived Data.
Faculty Signature:
Experiment - 12
Encoding and decoding of Convolution code
Generator polynomials:
g1=[1,0,1]
g2=[1,1,1]
Encoding:
1. Define the input binary data.
2. Set up the convolutional code parameters (generator polynomials, rate,
constraint length, etc.).
3. Use the convenc function to perform convolutional encoding on the input data.
Decoding:
1. Define the received encoded data (potentially with added noise or errors).
2. Set up the Viterbi decoder parameters (trellis structure, traceback depth, etc.).
3. Use the vitdec function to perform Viterbi decoding on the received encoded data.
OUTPUT:
Faculty Signature: