0% found this document useful (0 votes)
23 views124 pages

Ac DC Lab Manual

The document is a laboratory manual for the Analog and Digital Communication Laboratory at Rajiv Gandhi University of Knowledge Technologies, detailing a series of experiments related to communication engineering. It includes a list of experiments such as Amplitude Modulation, DSB-SC Modulation, and Frequency Modulation, along with the necessary apparatus, theoretical background, procedures, and expected outcomes for each experiment. The manual serves as a guide for students to understand and implement various modulation techniques using specified equipment.

Uploaded by

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

Ac DC Lab Manual

The document is a laboratory manual for the Analog and Digital Communication Laboratory at Rajiv Gandhi University of Knowledge Technologies, detailing a series of experiments related to communication engineering. It includes a list of experiments such as Amplitude Modulation, DSB-SC Modulation, and Frequency Modulation, along with the necessary apparatus, theoretical background, procedures, and expected outcomes for each experiment. The manual serves as a guide for students to understand and implement various modulation techniques using specified equipment.

Uploaded by

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

Rajiv Gandhi University of Knowledge Technologies,

(Act 8 of 2016 of Telangana Government)


Basar (Village and Mandal), Nirmal District, Telangana State-504107,India.
Website: www.rgukt.ac.in

Laboratory Manual
19EC3701 Analog and Digital Communication Laboratory

Department of Electronics & Communication Engineering


Analog and Digital Communication Laboratory Manual

List of Experiments
1. Amplitude Modulation and Demodulation.
2. DSB-SC Modulation and Demodulation.
3. Frequency Modulation.
4. Frequency division multiplexing.
5. PAM, PWM, PPM.
6. Automatic Gain Control circuit.
7. Carrier recovery circuit.
8. Mixer circuit.
9. Verification of Sampling theorem.
10. Quantizer design.
11. PCM implementation.
12. ASK,PSK,FSK,QPSK modulation demodulation.
13. Decoding of corrupted repetition code .
14. Time division multiplexing.
15. Using MATLAB, plot the constellation of BPSK, QPSK, without noise and with AWGN
(under different SNR values) and draw the decision boundaries. Observe the symbol errors,
bit errors.
16. Using MATLAB monte-carlo simulations, to find the BER versus SNR curves for ASK,
BPSK, FSK, QPSK, 16 PSK, 16-QAM with AWGN channel.
17. Using MATLAB program, find the Huffman code for given set of samples.

1
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENT NO-1
AMPLITUDE MODULATION &DEMODULATION

AIM:To study the function of Amplitude Modulation & Demodulation (under modulation,
perfect modulation & over modulation) and also to calculate the modulation index.

APPARATUS REQUIRED:

Name of the Specifications/Range Quantity


component/Equipment
Transistor BC547 01
Diode IN4007 02
Resistor 10kΩ,1kΩ,470Ω 06
Capacitor 10nF,2uF 003
Inductor 10mH 02
CRO TDS1002C- 01
EDU,DPO4102B,DS1054Z
Function Generator Scientech 415 01
(10MHz),RIGOL
DG1022(20MHz/100MSa/s)
FPS 12V 01

THEORY:
Modulation is defined as the process of changing the characteristics (Amplitude, Frequency or
Phase) of the carrier signal (high frequency signal) in accordance with the intensity of the
message signal (modulating signal).
Amplitude modulation is defined as a system of modulation in which the amplitude of the
carrier is varied in accordance with amplitude of the message signal (modulating signal).
The message signal is given by the expression.
Em(t) =Emcosωmt
Where ωm is -----> Angular frequency
Em -------- Amplitude
Carrier voltage Ec(t)= Eccosωct
E(t)=Ec + KaEmcosωmt
KaEmcosωmt ----- change in carrier amplitude
Ka----- constant
The amplitude modulated voltage is given by
E=E(t) cosωct
From above two equations
E= ( Ec+KaEmcosωmt) cosωct.

2
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

E= (1+KaEm/Eccosωmt) Eccosωct
E= Ec(1+Ma cosωmt)cosωct
Where Ma----- depth of modulation/ modulation index/modulation factor
Ma=KaEm/Ec
100* Ma gives the percentage of modulation.

The demodulation circuit is used to recover the message signal from theincoming AM wave at
the receiver. An envelope detector is a simple and yet highly effective device that is well suited
for the demodulation of AM wave, for which the percentage modulationis less than
100%.Ideally, an envelop detector produces an output signal that follows theenvelop of the input
signal wave form exactly; hence, the name. Some version of this circuit isused in almost all
commercial AM radio receivers. he Modulation Index is defined as,

m =( E max-E min )/(E max+ E min )

Where Emax and Emin are the maximum and minimum amplitudes of the modulated
wave.
The modulation is simply a method of combining two different signals and is used inthe
transmitter section of a communication system. The two signals that are used are theinformation
signal and the carrier signal. Amplitude Modulation is the simplest form ofsignal processing in
which the carrier amplitude is simply changed according to theamplitude of the information
signal hence the name Amplitude modulation. When theinformation signals amplitude is
increased the carrier signals amplitude is increased andwhen the information signals amplitude is
decreased the carrier signals amplitude isDecreased. The purpose of any detector or demodulator
is to recover the originalmodulating signal with the minimum of distortion and interference. The
simplest way ofdealing with an AM signal is to use a simple half- wave rectifier circuit. If the
signalwere simply passed through a diode to a resistive load, the output would be a series ofhalf-
cycle pulses at carrier frequency. So the diode is followed by a filter, typically acapacitor and
resistor in parallel. The capacitor is charged by the diode almost to the
peak value of the carrier cycles and the output therefore follows the envelope of theamplitude
modulation.

BLOCK DIAGRAM:
Modulation:

Modulating signal
generator
Am wave

A.M Modulator
Carrier Generator

3
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

Demodulation:
Modulating
signal
generator AM Modulator AM
Carrier Demodulator
Modulating
Generator
Signal
CIRCUIT DIAGRAMS:
Modulation:

4
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

Modulation circuit using Diode:

Demodulation:

PROCEDURE:

1. The circuit is connected as per the circuit diagram shown in above figure.
2. Switch on +12 volts Vcc Supply.
3. Apply Sinusoidal signal of 1 kHz frequency and amplitude 2 vpp as modulating signal and
carrier signal of frequency 16 kHz and amplitude as 5 vpp.
4. Now slowly increase the amplitude of the modulating signal upto +8 vpp and note down
values of E max and E min.
5. Calculate modulation index using Equation.
6. Repeat step 5 by varying frequency of the modulating signal.
7. Plot the graphs modulation index Vs amplitude & frequency.
8. Demodulation circuit observes, Find the value of R from 1/Fc <RC <1/Fm.
9. Connect the circuit as shown in above demodulation circuit.
10. Feed the AM wave to the demodulator circuit and observe the modulating signal.
11. Draw the Demodulated waveform from m=μ=1.

5
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPECTED WAVEFORMS:-

6
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

PRECAUTIONS:-
1. Loose connections are avoided.
2. Do not disturb the circuit while doing the experiment.
3. Equipment must be handle properly.
4. Apply the specified voltage with proper ground.
5. Check the connections before switching ON supply.
6. Switch off the power supply after completing experiment.

OBSERVATIONS:
Modulation

Vc Vm Vmax Vmin m=( Vmax-Vmin)/ m=


(Vmax+Vmin) Vm/Vc

Demodulation

Modulating signal Demodulated output


Frequeny(Fm) signal frequency

RESULT:

7
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENTNO-2
DSB-SC MODULATION AND DEMODULATION

AIM:To generate AM-Double Side Band Suppressed Carrier (DSB-SC) signal and
Modulating signal.

APPARATUS REQUIRED:
Name of the Specifications/Range Quantity
component/Equipment
Transformer 12-0-12 04
Diode IN4007 09
Resistor 1kΩ 02
Capacitor 10nF,2.2uF 04
Inductor 10mH 03
CRO TDS1002C- 02
EDU,DPO4102B,DS1054Z
Function Generator Scientech 415 02
(10MHz),RIGOL
DG1022(20MHz/100MSa/s)
FPS 12V 01

THEORY:
Balanced modulator circuit is used to generate only the two side bands DSB-SC. The
balanced modulation system is a system is a system of adding message to carrier wave
frequency there by only the side bands are produced. It consists of two AM modulators
arranged in a balanced configuration. The AM modulator is assumed to be identical. The
carrier input to the two modulators is same.
If we eliminate or suppress the carrier then the system becomes suppressed carrier
DSB-SC. In this we need reinsert the carrier is complicated and costly. Hence the suppressed
carrier DSB system may be used in point to point communication system.
Generation of suppressed carrier amplitude modulated volt balanced modulator may be
of the following types.
1. Using transistors orFET.
2. UsingDiodes
Standard AM contains a sinusoidal component atthe carrier frequency which does not
convey anymessage information. It is included to create apositive envelope which allows
8
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

demodulation by a simple inexpensive envelope detector. From aninformation theory point of


view, the power in thecarrier component is wasted.
Definition of the DSBSC-AM Signal
Letm(t) be a bandlimited baseband messagesignal with cutoff frequencyW. The DSBSC-
AMsignal corresponding tom(t) iss(t) =Acm(t)cosωctThis is the same as AM except with the
sinusoidalcarrier component eliminated.A messagem(t) typically has positive and negative
values so it can not be recovered froms(t) by anenvelope detector. A demodulation method
calledcoherent demodulation will be explored in thisexperiment.
Spectrum of a DSBSC-AM Signal:
The Fourier transform ofs(t) isS(ω) = 0.5AcM(ω−ωc) + 0.5AcM(ω+ωc)This is the
same as the AM spectrum but with thediscrete line at the carrier frequency removed. Anexample
is shown in the figure on Slide 6-6.
• The carrier frequency must satisfy the bound, ωc> Wso that the two shifted
basebandtransforms do not overlap.
• When they overlapfoldoveris said to haveoccurred and perfect demodulation cannot
beachieved.
Why the Term Double-Sideband isUsed:
Whenm(t) is a real signal,M(−ω) =M(ω) andS(ωc−ω) =S(ωc+ω) for 0≤ω≤ω
• This equation shows that the component atfrequencyωc+ωcontains exactly the
sameinformation as the component atωc−ωsinceone can be uniquely determined from
theother by taking the complex conjugate.
• The portion of the spectrum for|ω|>ωciscalled theupper sidebandand the portion for|ω|<ωcis
called thelower sideband.
• The fact that the modulated signal containsboth portions of the spectrum explains whythe
term, double-sideband, is used.
The Ideal Coherent Receiver forDSBSC-AM:

9
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

First, the received signal is passed througha bandpass filterB(ω) centered at the carrierfrequency
that passes the DSBSC signal andeliminates out-of-band noise. The output ofB(ω) is then
multiplied bya replica of the carrier wave. This replica isgenerated by a device called thelocal
oscillator(LO) in the receiver. The device that performsthe product is often called aproduct
modulatororbalanced mixer.
Ideal Coherent Receiver Analysis:
Assuming no noise, the product is
s1(t) = 2s(t) cosωct= 2Acm(t) cos2ωct
=Acm(t) +Acm(t) cos 2ωct
The Fourier transform of the product modulatoroutput is
S1(ω) =AcM(ω) + 0.5AcM(ω+ 2ωc)+ 0.5AcM(ω−2ω)
and is illustrated in the figure on Slide 6-6. Thefirst term on the right-hand side is proportional
tothe desired message. The second term has spectracomponents centered around−2ωcand 2ωc.
Thecorresponding terms can be seen inS1(ω). Theundesired high frequency terms are eliminated
bythe final lowpass filter which has cutoff frequencyW. This is often called apost detectionfilter.
Spectra in DSBSC-AMCommunication System:

10
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

A Demodulator Using thePre-Envelope:


An alternative method of demodulation is to firstform the pre-envelope of the received signal.
Withno additive noise, this is
s+(t) =s(t) +jˆs(t)
=Acm(t) cosωct+jAcm(t) sinωct
=Acm(t)ejωc
The baseband message is then recovered to withina scale factor by forming the complex product.
s+(t)e−jωct=Acm(t)
The Costas Loop Demodulator:
The Costas loop locks to the carrier frequencyand phase and performs nearly ideal
coherentdemodulation..

11
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

BLOCKDIAGRAM:
Modulation:

Modulating
signal Generator
Balanced
Modulator
Carrier Output
Generator

Demodulation:

Modulating signal
Generator
Balanced Demodulator
Modulator

Carrier Generator Output

Circuit Diagram:

Modulation:

12
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

Demodulation:

PROCEDURE:-
1.Connect the circuit as shown in figure.
2.A carrier signal of 1 Vpp amplitude and 16 kHz of frequency is applied.
3. Similarly message signal is also applied with the amplitude of 1Vpp amplitude and frequency
of 1 kHz.
4. Select the appropriate tuning circuit by selecting the inductance and capacitance values.
5.Then switch on the supply.
6. Observe the waveform on the CRO screen.
7 Check whether we are getting DSB-SC signal or not by the FFT (fast fourier Transform).
8.Observe the phase reversal is the output signal.
9.For demodulation, feed the demodulated output to the circuit shown in figure.
10. Obtain the base band signal.

13
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPECTED WAVEFORMS:-

Demodulated wave

OBSERVATIONS:
1. Phase reversal is occurring in the DSB-SC modulation.
2. The carrier component is suppressed.
3. The efficiency is 100%.

Carrier input Message signal Modulated or output


signal
Fc(Hz) Vc(volts) Fm(Hz) Vm(v) Fo(Hz) Vo(v)

14
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

PRECAUTIONS:
1. Connect the diode pattern carefully.
2. While connecting the transformers take care of the conditions.
3. Switch off the power supply after completion.

RESULTS:

15
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENT NO-3
DESIGN FREQUENCY MODULATION

AIM:To generate frequency modulated signal and determine the modulation index and
bandwidth for various values of amplitude and frequency of modulating signal. And demodulate
a Frequency Modulated signal using FM detector.

APPARATUS REQUIRED:

Name of the Specifications/Range Quantity


component/Equipment
IC 8038,565 02
Resistor 2kΩ,560Ω,10kΩ 03
Capacitor 10nF,10uF,100uF,470uF 06
POT 100K 01
CRO TDS1002C- 01
EDU,DPO4102B,DS1054Z
Function Generator Scientech 415 01
(10MHz),RIGOL
DG1022(20MHz/100MSa/s)
FPS +12V,-12V,0V,+5V,-5V 01

THEORY:
Frequency modulation is also called as angle modulation. Frequency modulation is
defined as changing the frequency of the carrier with respect to the message Signal amplitude.
Here the amplitude of the carrier remains fixed & timingParameter frequency is varied. When
the modulating signal has zero amplitude, Then the carrier has frequency of Fc as amplitude of
the modulating signal Increases. The frequency of the carrier increases, similarly, as the
amplitude of The modulating signal decreases, the frequency of the carrier decreases.
The process, in which the frequency of the carrier is varied in accordance with the instantaneous
amplitude of the modulating signal, is called “Frequency Modulation”. The FM signal is
expressed as
s(t ) A ( f ( f t ))
Where C A is amplitude of the carrier signal,
C f is the carrier frequency
b is the modulation index of the FM wave
Frequency modulation is a form of modulation, which represents information as
variations in the instantaneous frequency of a carrier wave. In analog applications, the
carrier frequency is varied in direct proportion to changes in the amplitude of an input
signal.The FM-modulated signal has its instantaneous frequency that varies linearly with the
amplitude of the message signal. Now we can get the FM-modulation by the following:

16
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

where Kƒ is the sensitivity factor, and represents the frequency deviation rate as a result of
message amplitude change. The instantaneous frequency is:

The maximum deviation of Fc (which represents the max. shift away from Fc in one
direction) is:

Note that The FM-modulation is implemented by controlling the instantaneous frequency


of a voltage-controlled oscillator(VCO). The amplitude of the input signal controls the
oscillation frequency of the VCO output signal. In the FM demodulation what we need to
recover is the variation of the instantaneous frequency of the carrier, either above or below
the center frequency. The detecting device must be constructed so that its output amplitude
will vary linearly according to the instantaneous freq. of the incoming signal. One approach
to perform demodulation, is using frequency discrimination:

In this method we differentiate the FM signal to get an AM signal, then we use an envelope
detector. The following figure how how to implement such a demodulator:

17
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

In this case, the output of the differentiator will be an AM modulated signal. The AM
modulated signal can be demodulated using an envelope detector. For more information
about the envelope detector refer to AM modulation lab.

The differentiator generates an output signal proportional to the first derivative of the input
with respect to time. The transfer function of this circuit is vo = -RC(dvi/dt)1. Obviously, a
constant input (regardless of its magnitude) generates a zero output signal.

CIRCUIT DIAGRAMS:

18
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

PROCEDURE:
1. The circuit is connected as per the circuit diagram shown in above figures.
2. Apply Sinusoidal signal of 16.5 kHz frequency and amplitude 5 vpp as a signal and
another signal of frequency 5 kHz andamplitude as 5 vpp.

3. Observe the FM output at pin3.


4. Plot the observations on a graph sheet.
5. Calculate the modulation index.
6. Calculate the BW.
7. Connections are made as per the circuit diagram.
8. Modulated signal is given as the input to 565.
9. In demodulated output the original message signal is recovered.

EXPECTED WAVEFORMS: -

19
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

PRECAUTIONS:-
1. Loose connections are avoided.
2. Do not disturb the circuit while doing the experiment.
3. Equipment must be handle properly.
4. Apply the specified voltage with proper ground.
5. Check the connections before switching ON supply
6. Switch off the power supply after completing experiment.

OBSERVATIONS:

Signal Amplitude Frequency Time


Message signal

Carriersignal

FM signal

Demodulated signal

RESULT:

Frequency Modulator and Demodulators are constructed and its waveforms are
analyzed by using CRO.

20
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENT NO-04
FREQUENCY DIVISION MULTIPLEXING

AIM:To construct the frequency division multiplexing circuit and to verify itsoperation

APPARATUS REQUIRED:

Name of the Specifications/Range Quantity


component/Equipment
Diode IN4007 02
Resistor 10kΩ,1kΩ 05

Capacitor 10nF 02
OpAmp IC741 01
Inductor 1mH,10mH 02
CRO TDS1002C- 01
EDU,DPO4102B,DS1054Z
Function Generator Scientech 415 (10MHz),RIGOL 01
DG1022(20MHz/100MSa/s)
FPS +12v,-12V,+5V,-5V,0V 01

THEORY:
The principle of the frequency division multiplexing is that several input messages
individually modulatethe subcarriers fc1, fc2, etc.after passing through LPFs to limit the message
bandwidth. We show thesubcarrier modulation as SSB, and it often is; but any of the CW
modulation techniques could beemployed or a Mixture of them. The modulated signals are then
summoned to produce the basebandsignal with the spectrumXb9f), the designation “baseband” is
used here to indicate that the final carriermodulation has not yet taken place.The major practical
problem of FDM is cross talks, the unwanted coupling of one message intoanother. Intelligible
cross talk arises primarily because of non linearity’s in the system, which cause 1message signal
to appear as modulation on subcarrier. Consequently, standard practice calls for
negativefeedback to minimize amplifier non linearity in FDM systems.
When several communications channels are between the two same point’s significant
economics may berealized by sending all the messages on one transmission facility a process
called multiplexing.Applications of multiplexing range from the vital, if prosaic, telephone
networks to the glamour of FMstereo and space probe telemetry system. There are two basic
multiplexing techniques.
1. Frequency Division Multiplexing (FDM)
2. Time Division Multiplexing (TDM)
The principle of the frequency division multiplexing is that several input messages
individually modulatethe subcarriers fc1, fc2,etc.after passing through LPFs to limit the message
bandwidth. We show thesubcarrier modulation as SSB, and it often is; but any of the CW
modulation techniques could beemployed or a Mixture of them. The modulated signals are then

21
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

summoned to produce the basebandsignal with the spectrumXb9f), the designation “baseband” is
used here to indicate that the final carriermodulation has not yet taken place.
The major practical problem of FDM is cross talks, the unwanted coupling of one
message intoanother. Intelligible cross talk arises primarily because of non-linearity’s in the
system, which cause 1message signal to appear as modulation on subcarrier. Consequently,
standard practice calls for negativefeedback to minimize amplifier non linearity in FDM systems.
It has been observed that most of the individual data-communicating devices typically
require modest data rate. But, communication media usually have much higher
bandwidth. As a consequence, two communicating stations do not utilize the full capacity
of a data link. Moreover, when many nodes compete to access the network, some
efficient techniques for utilizing the data link are very essential. When the bandwidth of a
medium is greater than individual signals to be transmitted through the channel, a
medium can be shared by more than one channel of signals. The process of making the
most effective use of the available channel capacity is called Multiplexing. For
efficiency, the channel capacity can be shared among a number of communicating
stations just like a large water pipe can carry water to several separate houses at once.
Most common use of multiplexing is in long-haul communication using coaxial cable,
microwave and optical fibre.
Below Figure depicts the functioning of multiplexing functions in general. The
multiplexer is connected to the demultiplexerby a single data link. The multiplexer
combines (multiplexes) data from these ‘n’ input lines and transmits them through the
high capacity data link, which is being demultiplexed at the other end and is delivered to
the appropriate output lines. Thus, Multiplexing can also be defined as a technique that
allows simultaneous transmission of multiple signals across a single data link.

Multiplexing techniques can be categorized into the following three types:

Frequency-division multiplexing (FDM): It is most popular and is used extensively


in radio and TV transmission. Here the frequency spectrum is divided into several
logical channels, giving each user exclusive possession of a particular frequency
band.
In frequency division multiplexing, the available bandwidth of a single physical medium
is subdivided into several independent frequency channels. Independent message signals
are translated into different frequency bands using modulation techniques, which are
combined by a linear summing circuit in the multiplexer, to a composite signal. The
resulting signal is then transmitted along the single channel by electromagnetic means as
shown in Fig. Basic approach is to divide the available bandwidth of a single
physical medium into a number of smaller, independent frequency channels. Using

22
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

modulation, independent message signals are translated into different frequency bands.
All the modulated signals are combined in a linear summing circuit to form a composite
signal for transmission. The carriers used to modulate the individual message signals are
called sub-carriers, shown as f1, f2, …, fnin Figure.
At the receiving end the signal is applied to a bank of band-pass filters, which separates
individual frequency channels. The band pass filter outputs are then demodulated and
distributed to different output channels

BLOCK DIAGRAM:

23
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

CIRCUIT DIAGRAM:

PROCEDURE:
1. Connect the circuit according to the circuit diagram given above.
2. Connect the circuit to the mains and switch on the power supply.
3. Message signal and carrier signal is given to the modulator circuit.
4. Here two modulator circuits are there in the FDM circuit.
5. Two modulators are connected to the summer or channel.
6. It gives single output.
7. That output is FDM signal.
8. Here carrier signals are two different frequencies.

24
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPECTED WAVEFORMS:

PRECAUTIONS:
1. Loose connections are avoided.
2. Do not disturb the circuit while doing the experiment.
3. Equipment must be handle properly.Apply the specified voltage with proper ground
4. Check the connections before switching ON supply.
5. Switch off the power supply after completing experiment.

TABULAOR FORM:

Signals Amplitude Time


Message signal1
Message signal2
Carrier signal1
Carrier signal2
FDM signal

RESULT:

25
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENT NO-5
DESIGN PAM, PWM, PPM

AIM:To design and obtain the characteristics of a PAM, PWM AND PPM Wave forms.
APPARATUS REQUIRED:

Name of the Specifications/Range Quantity


component/Equipment
Diode IN4007 02
Resistor 500Ω,10KΩ,1.5KΩ,4KΩ,3KΩ,150Ω 09
Capacitor 100nF,10nF,1uF 07
BJT 547 01
IC 555 02
Inductor 10mH 01
CRO TDS1002C-EDU,DPO4102B,DS1054Z 01
Function
ScientechGenerator
415 (10MHz),RIGOL DG1022(20MHz/100MSa/s) 01
Fixed Power Supply +5V,-5V,0V 01

THEORY:
PAM is the simplest form of data modulation the amplitude of uniformly spaced pulses is
varied in proportion to the corresponding sample values of a continuous message m (t). A PAM
waveform consists of a sequence of flat-topped pulses. The amplitude of each pulse corresponds
to the value of the message signal x (t) at the leading edge of the pulse. The pulse amplitude
modulation is the process in which the amplitudes of regularity spaced rectangular pulses vary
with the instantaneous sample values of a continuous message signal in a one-one fashion. A
PAM wave is represented mathematically as,
PAM is of two types
1) Double polarity PAM ==> This is the PAM wave which consists of both positive and negative
pulses shown as
2) Single polarity PAM ==> This consists of PAM wave of only either negative (or) Posit pulses.
In this the fixed dc level is added to the signal to ensure single polarity signal.
In pulse amplitude modulation, the amplitudes of regularly spaced rectangular pulses
vary with the instantaneous sample values of a continuous message signal in a one to one
fashion. The pulse in PAM can be of rectangular or the type that we have arrival in natural
sampling. The carrier under goes amplitude modulation in PAM. The width of the pulse remains
fixed. Natural sample method is used here to generate the PAM signal. The diodes are used as a
switching element. If the closing time t of the diode approaches zero, the output gives only the
instantaneous value. Since the width of the pulse approaches zero. The instantaneous sampling
gives train of impulses. The area of each sampledsection is equal to the instantaneous value of
the signal input. This signal is modulated with the message signal. Thus we get the PAM output.

26
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

The PWM is also known as pulse duration modulation. It modulates the time parameter
of the pulses. The width of PWM pulses varies. The amplitude is constant; width of the pulse is
proportional to the amplitude of the modulating signal. Bandwidth on transmission channel
depends on rise time of the pulse. The demodulation circuit used is a simple filter circuit that
demodulator the PWM signal and gives the original message input.
Pulse Time Modulation is also known as Pulse Width Modulation or Pulse Length
Modulation. In PWM, the samples of the message signal are used to vary the duration of the
individual pulses. Width may be varied by varying the time of occurrence of leading edge, the
trailing edge or both edges of the pulse in accordance with modulating wave. It is also called
Pulse Duration Modulation.
In Pulse Position Modulation, both the pulse amplitude and pulse duration are held
constant but the position of the pulse is varied in proportional to the sampled values of the
message signal. Pulse time modulation is a class of signaling techniques that encodes the sample
values of an analog signal on to the time axis of a digital signal and it is analogous to angle
modulation techniques. The two main types of PTM are PWM and PPM. In PPM the analog
sample value determines the position of a narrow pulse relative to the clocking time. In PPM rise
time of pulse decides the channel bandwidth. It has low noise interference.
In analog modulation systems, some parameter of a sinusoidalcarrier is varied according
to the instantaneous value of themodulating signal.In Pulse modulation methods, the carrier is no
longer acontinuous signal but consists of a pulse train. Some parameterof which is varied
according to the instantaneous value of themodulating signal.

27
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

There are two operations involved in the generation of PAMsignal.


1. Instantaneous sampling of the message signal m(t) every Tsseconds, where the sampling rate
fs = 1/Ts is chosen inaccordance with the sampling theorem.
2. Lengthening the duration of each sample so obtained to someconstant value T.
We may express the PAM signal as

Where
Ts = sampling period
m(nTs) = sample value of m(t) obtained at t = nTs
h(t) = standard rectangular pulse of unit amplitude and duration
T and it is defined as

The spectrum of flat-top PAM signal is

Demodulation of PAM
Ideally, the magnitude response of the equalizer is given by

The amount of equalization needed in practice is usuallysmall.

Pulse Time Modulation (PTM)


In pulse time modulation, amplitude of pulse is heldconstant, whereas position of pulse or width
of pulse ismade proportional to the amplitude of signal at thesampling instant.
There are two types of pulse time modulation.
i. Pulse Width Modulation
ii. Pulse Position Modulation
PWM is also called Pulse Duration Modulation (PDM), Pulse Length Modulation (PLM) andIn
PWM, Width of the pulses of the carrier pulse train is varied in accordance with the modulating

28
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

signal. In PPM, the position of the pulse relative to its un-modulatedtime occurrence is varied in
accordance with the messagesignal.

BLOCK DIAGRAMS:
Modulation: PAM

29
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

Modulation: PWM

Modulation: PPM

CIRCUIT DIAGRAMS:
Modulation: PAM circuit

30
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

PWM circuit:

PPM circuit:

31
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

Demodulation circuit:

PROCEDURE:
PAM Procedure:
1. The circuit is connected as per the circuit diagram shown in above figure
2. Apply Sinusoidal Modulating signal of 1 kHz frequency and amplitude 4 vpp as a signal
and Carrier signal of frequency 10 kHz and amplitude as 5 vpp.
3. Observe the output on CRO is PAM wave.
4. Measure the levels of Emax and Emin.
5. Feed the modulated wave to the low pass filter as input.
6. The output observed on CRO will be demodulated wave.
7. Note down the amplitude(Vpp) and time period of the demodulated wave vary the
amplitude and frequency of modulating signal. Observe and note down the changes in output.
8. Plot the waveforms on graph sheet.
PWM Procedure:
1. The circuit is connected as per the circuit diagram shown in above figure
2. Apply a trigger signal of triggering of 22.7KHz with amplitude of 5Vpp.
3. Observe the sample output at pin 3.
4. Apply the Modulating signal of frequency 1KHz at pin 5 and vary the amplitude.
5. As we are varying the control voltage the output pulse width is varied.
6. The Pulse width increases due to positive slope condition and decreases under negative
slope the width is maximum at positive and minimum at negative peak.
7. The demodulation is done by feeding the modulated output to the circuit as shown in
figure.
PPM Procedure:
1. The circuit is connected as per the circuit diagram shown in above figure.
2. Apply the modulating signal sinusoidal signal of 1KHz with amplitude of 5Vpp.
3. Observe the sample output at pin3 and observe the position of the pulses on CRO and
adjust the amplitude by slightly increasing the power supply Also observe the frequency of pulse
output.

32
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

4. Now by varying the amplitude of the modulating signal note down the position of the
pulse.
5. During the demodulation process give the ppm signal as input to the demodulated circuit
as shown in figure.
6. Observe the output on CRO.
7. Plot the waveform.

EXPECTED WAVEFORMS:-

PRECAUTIONS:-
1. Loose connections are avoided.
2. Do not disturb the circuit while doing the experiment.
3. Equipment must be handle properly.
4. Apply the specified voltage with proper ground.
5. Check the connections before switching ON supply
6. Switch off the power supply after completing experiment.

33
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

OBSERVATIONS:
PAM observation:
Amplitude Time Frequency
Message signal

Carrier signal

PAM signal

Demodulated signal

PWM observation:
S.NO Control voltage Vpp Output pulse width
time(m.sec)

PPM observation:
Modulating signal Time period (ms) Total time
amplitude(Vpp) period (ms)
Pulse width Pulse width
ON(ms) OFF(ms)

Demodulated signal:
Amplitude Time(ms) Frequency(Hz)

34
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

RESULT: Observe PAM wave and demodulated signal, PWM wave and demodulated signal,
PPM wave and demodulated signal.

35
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENT NO-06
AUTOMATIC GAIN CONTROL CIRCUIT

AIM: To study the AGC Characteristics

APPARATUS REQUIRED:

Name of the Specifications/Range Quantity


component/Equipment
Transistor 2N3904 01
Resistor 10kΩ,1kΩ,33kΩ,100kΩ,120kΩ,240kΩ 09

Capacitor 10uF 04
OpAmp IC741 01
J FET J176 01
CRO TDS1002C- 01
EDU,DPO4102B,DS1054Z
Function Generator Scientech 415 (10MHz),RIGOL 01
DG1022(20MHz/100MSa/s)
FPS +12v,-12V,+5V,-5V,0V 01

THEORY:
A Simple AGC is a system by means of which the overall gain of a radio receiver is
varied automatically with the changing strength of the received signal, to keep the output
substantially constant. The devices used in those stages are ones whose trans conductance and
hence gain depends on the applied bias voltage or current. It may be noted that, for correct AGC
operation, this relationship between applied bias and trans conductance need not to be strictly
linear, as long as trans conductance drops significantly within creased bias. All modern receivers
are furnished with AGC, which enables tuning to stations of varying signal strengths without
appreciable change in the size of the output signal thus AGC "irons out" input signal amplitude
variations, and the gain control does not have to be re adjusted every time the receiver is tuned
from one station to another, except when the change in signal strength is enormous In addition,
AGC helps to smooth out the rapid fading which may occur with long-distance short-wave
reception and prevents the overloading of the last IF amplifier which might otherwise have
occurred.
The main purpose of the receiver is to recreate the original message signal from the degraded
version of the transmitted signal after propagation through the free space.

36
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

The Super Heterodyne Receiver


The Basic receiver is shown in fig. (1) The first stage is a tuned RF amplifier, using two
variable tuned circuits that track each other and the local oscillator. The two tuned RF circuits
form a band pass filter to pass the desired RF signal frequency while blocking others. This stage
acts to boost the weak signal level from the antenna above the noise level to provide same signal
selectivity and to prevent other channel signal to pass through. The output signal from the
amplifier is fed to one input of the mixer circuit and the local oscillator signal to the other. The
local oscillator is variable tuned so as to track the incoming signal frequencies.
The mixer output (the difference frequency for down-conversion) is fed to multistage
tuned. IF amplifiers, which are fixed-tune and provided with sufficient selectivity to reject
adjacent channel signals. The output from the IF amplifier chain is fed to the detector circuit.
Where the audio signal is extracted from the IF signal or demodulated. The detector also
provides signals for automatic gain control (AGC). The AGC signal is used as a bias signal to
reduce the gain of the RF and the IF amplifiers to prevent detect or over load. AGC is a system
means of which the overall gain of a radio receiver is varied automatically with the changing
strength of the received signal to to keep the output substantially constant. The audio signal from
the detector is passed through a low pass filter to remove unwanted high frequency components
and then through a volume control to an audio amplifier. The audio amplifier is usually one low-
level audio stage followed by a power amplifier and a speaker.
The gain required in the RF and IF amplifier chain of the receiver depends on the
required input and output. The input is the minimum variable signal level to be presented at the
antenna terminals. The output is the minimum signal level at the input of the detector required to
make the detector perform satisfactorily. In this trainer we used Radio receiver IC 1610S which
is having in-built RF amplifier , Local oscillator, a mixer, IF amplifiers and AGC detector, audio
amplifier to drive a speaker.

37
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

BLOCK DIAGRAM:

CIRCUIT DIAGRAM:

38
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

PROCEDURE:

1. Connect the circuit according to the circuit diagram given above.


2. Connect the circuit to the mains and switch on the power supply.
3. Measures the output voltages of the regulated power supply circuit i.e. +12v and -12v,
+6@150mA.
4. Connect the Message signal to the input of AGC and observe to the CRO channel -1
5. Connect AGC link to the feedback network through OA79 diode
6. Now connect CRO channel - 1 at output. The detected audio signal of 1 KHz will be
observed.
7. Calculate the voltage gain by measuring the amplitude of output signal (Vo) waveform,
using Formula A = Vo/V I
8. Now vary input level of 1 KHz audio signal with and Without AGC link. The output will
be distorted when AGC link removed i.e. there is no AGC action.
9. This explains AGC effect in Radio circuit.

EXPECTED WAVEFORM:

39
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

PRECAUTIONS:-
1. Loose connections are avoided.
2. Do not disturb the circuit while doing the experiment.
3. Equipment must be handle properly.Apply the specified voltage with proper ground.
4. Check the connections before switching ON supply.
5. Switch off the power supply after completing experiment.

Tabular form:

Signal Type: Freqency Amplitude


Modulating Signal

Modulated Signal

RESULT:

40
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENT NO-07
DESIGN OF A CARRIER RECOVERY CIRCUIT

AIM: To design a carrier recovery circuit of a bpsk signal.


APPARATUS REQUIRED:

Name of the Specifications/Range Quantity


component/Equipment
Diode IN4007 01
Resistor 1kΩ 03
Capacitor 10nF 01
Inductor 10mH 01
CRO TDS1002C- 01
EDU,DPO4102B,DS1054Z
Function Generator Scientech 415 (10MHz),RIGOL 01
DG1022(20MHz/100MSa/s)

THEORY:
A central point is associated with a digital modulation scheme, there is channel capacity,
as we learn in Digital Coding and Transmission This channel capacity is smaller than the channel
capacity of ideal AWGN channel with Gaussian signal – recall capacity is maximized if signal
PDF is Gaussian Nevertheless, we may use the latter as upper limit for our practical digital
modulated channel as first approximation As channel capacity is linked with bandwidth and
signal to noise ratio, not surprisingly, performance measures of a digital modulation scheme are
:Power efficiency and bandwidth efficiency

This lecture we continue on Modem, and look into phase shift keying modulation, in
particular, BPSK and QPSK with emphasis on operations of carrier recovery and timing recovery
and introduce concepts of coherent and non-coherent systems

In PSK, the modulation signal set is:

si(t) =Acos(2πfct+φi(t)), i= 1,···, M,0≤t≤Ts

Ts is symbol period,

A is carrier amplitude (constant),

“phase”φi(t)

41
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

Carries symbol information, andlog 2Mbits per symbol BPSK, QPSK, 8-PSK, etc with 1 bit per
symbol, 2 bits per symbol, 3 bits per symbol, etc, and minimum phase separation180◦, 90◦,45◦,
etc, respectively

BPSK: M= 2. It is convention to usem1= 1for bit 0, andm2=−1for bit 1

si(t) =Acos(2πfct+ (i−1)π+θc),0≤t≤Tb


Tb: bit period

θc: an initial phase

Energy per bit for BPSK: Eb=1/2A^2 Tb

Or A= (2Eb/Tb)^1/2

Transmitter: Data bit stream with bit rate Rb are filtered by a low pass filter (square root
of raised cosine pulse shaping filter) to generate baseband signal m(t), which is then modulated
by carrier–PSD of BPSK RF signal with raised cosine pulse shaping: Baseband complex
envelope signal.

g(t) =m(t) A exp (jθc)

m(t) being pulse shaped symbol m1 or m2

Transmitted BPSK signal

s(t) =Re[g(t) exp(j2πfct)] =m(t)A cos(2πfct+θc)

BPSK symbol information±1are carried in baseband signal m(t)

Recall in Digital Coding and Transmission, we learn BPSK baseband signal m(t)is the dashed
curve, which carries BPSK symbol information

Transmitted RF signal s(t)is obtained by modulating carrier A cos(2πfct+θc) by modulating


signal m(t)

Receiver: received RF signal is given by s(t) =α·m(t)Acos(2πfct+θ) +n(t)

α: channel gain or attenuation, θ: random phase including phase shift due to channel delay, n(t):
channel AWGN

For illustrating basic concept of demodulation, assume no channel distortion, omit noise
and drop amplitude A, then received RF signal is simplified to

42
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

S^(t) =m(t) cos(2πfct+θ)

Carrier recovery must obtain carrier cos(2πfct+θ)in order to demodulates^(t):

S^(t)·cos(ωct+θ) =m(t)2·(1 + cos(2ωct+ 2θ))

The LPF at receiver then filters this to obtain baseband signal m(t)Bit (symbol) timing
recovery recovers clock pulses to obtain samples at appropriate instances for decision circuit,
which detects transmitted bits (symbols)Carrier recovery: operate at RF to try to align receiver
local oscillator with transmitted carrier frequency (and phase), which is only required for
coherent or synchronous demodulation Clock recovery: operate at baseband to try to synchronies
receiver clock with baseband symbol rate transmitter clock, which is needed for any receiver
(coherent or non-coherent demodulation) Coherent receiver has better performance but higher
complexity than non-coherent receiver.

Let received RF signal

Bes^(t) =m(t)·cos(ωct+θ)

If receiver knows carrier cos(ωct+θ),

it can use this information to demodulate .s^(t)so as to obtain baseband signal m(t)

Recover the carrier (phase):time2 carrier recovery scheme, which works well for BPSK signals,
but not for quadrature signals with equal average power in each quadrature branch

Time-2 carrier recovery:–Square device, BPF,PLL which produces cos (2ωct+ 2̂θ), and–
frequency divider which generates cos(ωct+̂θ)Nonlinear square device generatesm2(t)
cos2(ωct+θ) =12m2(t)(1+cos(2ωct+2θ)).BPF centred at2fcgetscos(2ωct+ 2θ)and uses it to drive
a phase locked loop Phase locked loop consists of a low pass filter, a multiplier and a voltage
controlled oscillator–VCO oscillates at2fcwith an initial phasêθ, and its output, sin(2(ωct+̂θ)), is
multiplied by cos(2(ωct+θ))to obtain e(t) =12sin(4ωct+ 2(θ+̂θ)) +12sin(2(θ−̂θ))–The first term is
removed by the LPF, while the second termc(t) =12sin(2(θ−̂θ))≈∆θif∆θ≪1is used to drive the
VCO, so that its phaseθ^ locks to θ, i.e .̂θ→θ–In order for c(t)→0, initial phaseθ^ of VCO should
not be far away from true carrier phaseθ• Frequency divider then divides cos(2(ωct+θ))to
produce the carrier cos (ωct+θ)Alternative PLL with its VCO operates at fc– Work out its circuit
diagram.

43
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

BLOCK DIAGRAM:

CIRCUIT DIAGRAM:

44
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

PROCEDURE:

PSK Modulator:
1. Connect the circuit as shown in circuit diagram.
2. Apply Message signal as Digital data (1KHz frequency,5Vpp amplitude) is given input
to the base terminal of BJT and Carrier signal (10KHz frequency,5Vpp) is given input to the
collector terminal of the BJT
3. Another carrier signal (10KHz frequency,1Vpp)is given to input of the emitter terminal
of the pnp transistor.
4. Outputs are observed collector terminal of NPN BJT and emitter terminal of PNP BJT.
5. These two outputs are subtraction through OP AMP it’s given Phase shift keying output.

Carrier Recovery Circuit:


1. Connect the circuit as shown in circuit diagram.
2. First connection LM 565 circuit. Now adjust the potentiometer P1 to get the free running
frequency 32 KHz. Then you will complete remaining circuit.

45
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

3. Apply BPSK Modulated signal is given input to the Carrier Recovery Circuit.
4. Here Squaring Device Output is given input to BPF.
5. BPF Output is given input to PLL circuit.
6. PLL Output is given input to Frequency Divider circuit.
7. Frequency Divider circuit Output is given input as Low Pass Filter.
8. Low Pass Filter Output Like as Original Carrier signal.

Expected Waveform:

PRECAUTIONS:-
1. Loose connections are avoided.
2. Do not disturb the circuit while doing the experiment.
3. Equipment must be handle properly.
4. Apply the specified voltage with proper ground.
5. Check the connections before switching ON supply.
6. Switch off the power supply after completing experiment.

OBSERVATIONS:
Signal Amplitude Frequency

RESULT: To verify a carrier recovery circuit of a bpsk signal and Observe Original Carrier
signal with same Frequency and Phase angle.

46
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENT NO-8
DESIGN OF A MIXER CIRCUIT

AIM: To design and obtain the characteristics of a mixer circuit.


APPARATUS REQUIRED:

Name of the Specifications/Range Quantity


component/Equipment
Diode IN4007 01
Resistor 1kΩ 03
Capacitor 10nF 01
Inductor 10mH 01
CRO TDS1002C- 01
EDU,DPO4102B,DS1054Z
Function Generator Scientech 415 (10MHz),RIGOL 01
DG1022(20MHz/100MSa/s)

THEORY:
Figure 1 shows the typical block diagram of a Transmitter and a Receiver. It can be seen
that in both cases frequency translation is achieved by the use of a Mixer. The mixers can be
either passive mixers using diodes or they can be active mixers using transistors or FETs. In
many receivers and transmitters, a succession of mixing and filtering stages are used, to ensure
that the filtering requirements can be satisfied. A mixer is used as an up-converter when the
output frequency is higher than the input frequency. This is typical in a transmitter. A mixer is
used as a down-converter when the output frequency is lower than the input frequency. This is
typical for a receiver.

47
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

Figure 2 shows the frequencies that need to be considered when using a mixer. For a
down-converter the Radio Frequency (RF) signal is mixed with a Local Oscillator (LO) signal to
produce sum and difference frequencies. The sum frequency is outside the operating frequency
range of the system and the difference frequency is the required Intermediate Frequency (IF)
signal, which is filtered and amplified using an IF filter and its associated amplifiers. The RF
filter should be sufficiently narrow so that the image frequency is not passed through the RF
filter, since the difference frequency of the image frequency and the local oscillator is at exactly
the same frequency as the required IF signal. An ideal multiplier is a perfect mixer since when
the LO signal is multiplied by an RF signal then sum and difference frequencies are generated,
the difference frequency being the required IF signal and the sum signal being an unwanted high
frequency component, which is normally filtered out. For an up-converter, the LO signal is
multiplied by an IF signal and a double sideband suppressed carrier RF signal results. The aim in
mixer design is thus to make the mixer behave as close to an ideal multiplier as possible. There
are two types of mixers: 1) Passive mixers, using diodes, where the LO power provides the
power for the mixer. 2) Active mixers, where transistors or FETs supplied with DC power
provide the mixing action.

The mixer is a nonlinear device having two sets of input terminals and one set of output
terminals. Mixer will have several frequencies present in its output, including the difference
between the two input frequencies and other harmonic components.

One of the most useful RF or radio frequency processes is that of mixing. Unlike an
audio mixer where signals are simply added together, when a radio or RF engineer talks about
mixing, he means a whole different process. Here signals are multiplied together and signals an
new frequencies are generated.

The process of RF or non-linear mixing or multiplication is used in virtually every radio


set these days and also in many other circuits beside. It enables signals to be changed from one
frequency to another so that signal processing for example can be undertaken on a low frequency
where it is easier to perform, but the signal can be changed to a from a higher frequency where
the signal is to be transmitted or received.

48
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

It is found that if two signals are passed through a non-linear circuit, then additional
signals on new frequencies are formed. These appear at frequencies equal to the sum and
difference frequencies of the original signals. In other words if signals at frequencies of f1 and f2
enter the mixer, then additional signals at frequencies of (f1+f2) and (f1-f2) will also be seen at
the output.

To give an example if the two original signals are at frequencies of 1 MHz and 0.75
MHz, then the two resultant signals will appear at 1.75 MHz and 0.25 MHz Mixing two RF
signals.

To understand a little more about the RF mixing or multiplication process it is necessary


to look at exactly how the mixing process occurs. As mentioned before the two signals are
actually multiplied together, and this occurs as a result of a non-linear element in the circuit. This
may be a diode, or active devices such as transistors or FETs that are suitably biased.

The two signals can be considered as sine waves. The instantaneous output level is
dependent upon the instantaneous level of signal A multiplied by the instantaneous level of
signal B. If points along the curve are multiplied, then the output waveform is more complex as
shown below.

BLOCK DIAGRAM:

CIRCUIT DIAGRAMS:

49
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

PROCEDURE:

1. The circuit is connected as per the circuit diagram shown in above figure.
2. Apply Sinusoidal signal of 10 kHz frequency and amplitude 5 vpp as a signal and another
signal of frequency 5 kHz and amplitude as 5 vpp.
3. The instantaneous output level is dependent upon the instantaneous level of signal A
multiplied by the instantaneous level of signal B. If points along the curve are multiplied,
then the output waveform is more complex as shown below.

EXPECTED WAVEFORMS:-

50
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

PRECAUTIONS:-
1. Loose connections are avoided.
2. Do not disturb the circuit while doing the experiment.
3. Equipment must be handle properly.
4. Apply the specified voltage with proper ground.
5. Check the connections before switching ON supply.
6. Switch off the power supply after completing experiment.

OBSERVATIONS:

Signal Amplitude Frequency

RESULT:
To obtain Mixer output wave forms.

51
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENT NO-9
VERIFICATION OF SAMPLING THEOREM

AIM:
1. To study the sampling theorem and its reconstruction.
2. To study the effect of variation of sampling frequency on the demodulated output.

APPARATUS REQUIRED:
Name of the Specifications/Range Quantity
component/Equipment
Transistor BC547 01
Resistor 10kΩ,1kΩ,470Ω 06
Capacitor 10nF,2Uf 03
CRO TDS1002C- 02
EDU,DPO4102B,DS1054Z
Function Generator Scientech 415 02
(10MHz),RIGOL
DG1022(20MHz/100MSa/s)

THEORY:
Pulse Modulation is used to transmit analog information. In this system continuous wave
forms are sampled at regular intervals. Information regarding the signal is transmitted only at the
sampling times together with synchronizing signals. At the receiving end, the original waveforms
may be reconstituted from the information regarding the samples.
Sampling Theorem Statement:
A band limited signal of finite energy which has no frequency components higher than fm Hz, is
completely described by specifying the values of the signal at instants of time separated by ½ fm
seconds.
The sampling theorem states that, if the sampling rate in any pulse modulation system exceeds
twice the maximum signal frequency, the original signal can be reconstructed in the receiver
with minimum distortion.
Fs > 2fm is called Nyquist rate.
Where fs – sampling frequency
Fm – Modulation signal frequency.
If we reduce the sampling frequency fs less than fm, the side bands and the information signal
will overlap and we cannot recover the information signal simply by low pass filter. This
phenomenon is called fold over distortion or aliasing. There are two methods of sampling. (1)
Naturalsampling (2) Flat top sampling.

52
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

Sample & Hold circuit holds the sample value until the next sample is taken. Sample & Hold
technique is used to maintain reasonable pulse energy.The duty cycle of a signal is defined as the
ratio of Pulse duration to the Pulse repetition period. The duty cycle of 50% is desirous taking
the efficiency into account.

Fig 28.4 shows a signal with frequency content between ±B Hz . Such signals are said to
be band limited signals. Note that because

magnitude component of a real life signals have typically an even symmetry around dc signal.
By the observation made in the previous slide that a signal of ƒ0 Hz can be aliased to (ƒ0 ± ƒs)
Hz { = ±1, ± 2,--- } , it follows that post sampling in frequency domain, we will see repeating
lobes (replicas) of original signal, each lobe being displaced by ƒs Hz. In other words, after
sampling we cannot distinguish the signal lobe from other replicated lobes.
An interesting analog can be drawn by considering a room having many mirrors each
reflecting image from one to another. It is seen that if a person is standing in such a room,
another observer cannot distinguish him from his image. The difficulty can be resolved if the
observer has an idea of location or coordinates of the real person. In the same manner, we can
identify the original lobe from replicated lobes if we have an idea of the frequency content of
original signal. In fig 28.5, notice that lobes are distinctly separated because ƒs > 2B Hz . On the
other hand, if ƒs = 2B Hz , then as seen in fig 28.6,lobes will just touch each other. If however,
ƒs < 2B Hz, then lobes will overlap (fig 28.7) and this will lead to distortion of replicated
frequency spectrum. Thus, it is necessary that ƒs the sampling frequency should at least equal to
2B Hz.

53
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

Thus qualitatively, we can classify sampling frequency into three categories.


1.Sampling at a rate
2.Sampling at a rate
3.Sampling at a rate
When sampling frequency, ƒs< 2B, then there is an overlapping effect around frequency ƒs/2,
known as the folding frequency. As a consequence of superposition, the frequency domain information is
distorted. Thus, we should choose ƒs > 2B. This important result is a part of sampling theorem stated
below in two equivalent ways.
A band limited signal of finite energy, which has no frequency component higher than Hz, is completely
described by specifying the values of the signal at instants of time separated by seconds.2.A band limited
signal of finite energy which has no frequency component higher than Hz may be completely recovered
from the knowledge of its samples taken at a rate of per sec. The sampling rate of 2B samples per sec is
known as Nyquist rate.
In practice, even a band limited signal will contain noise. Noise reflects as high frequency
component in the overall spectrum, (fig 28.8). Thus, even if we sample the signal at a rate say
Hz, we cannot reconstruct the correct frequency domain information. Noise is aliased to lower
frequency. It distorts the frequency domain information by superposing an alias of noise on the
original signal. To avoid this, in practice it is necessary to pass the continuous signal first
through an analog low pass filter. Such a filteris known as anti-aliasing filter. Fig 28.9 illustrates
this concept.
The demodulation section comprises of a fourth order low pass filter and an AC amplifier. The
TL074 (U5) is used as a low pass filter and AC amplifier. The output of the modulator is given
as the input to the low pass filter. The low pass filter output is obviously less and it is fed to the
AC amplifier which comprises of a single op amp and whose output is amplified.

54
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

CIRCUIT DIAGRAM:
Modulation Circuit:

Reconstruction Filter:

EXPECTED WAVEFORMS:

DEMODULATED OUTPUT:

55
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

sampled frequency spectrum with different conditions is given by the following


diagrams:

Procedure:
56
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

1. Connect the circuit as per the circuit diagram.


2. Give the power supply.
3. Connect the output to the CRO so that we can observe the output clearly.
4. Observe the input and out waveforms.
5. Observe the spectrum and FFT.
6. Analyze the theoretical and practical observations.

Precautions:
1. Loose connections are avoided.
2. Do not disturb the circuit while doing the experiment.
3. Equipment must be handle properly.
4. Apply the specified voltage with proper ground.
5. Check the connections before switching ON supply.
6. Switch off the power supply after completing experiment.

Observations:
1. The output waveform looks like staircase waveform.
2. We cannot observe discharging time since we have not provide discharging path in the
circuit.

Result:

57
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENT NO-10
QUANTIZER DESIGN

AIM: To design and verify 1-bit quantizer.


APPARATUS REQUIRED:
Name of the Specifications/Range Quantity
component/Equipment
Op amp IC741 04
Resistor 10kΩ,1kΩ,470Ω 06
IC 7404,7408 03
CRO TDS1002C- 02
EDU,DPO4102B,DS1054Z
Function Generator Scientech 415 02
(10MHz),RIGOL
DG1022(20MHz/100MSa/s)
Fixed Power Supply +5v/-5v 01

Theory:
Quantization, in mathematics and digital signal processing, is the process of mapping
input values from a large set (often a continuous set) to output values in a (countable) smaller set,
often with a finite number of elements. Rounding and truncation are typical examples of
quantization processes. Quantization is involved to some degree in nearly all digital signal
processing, as the process of representing a signal in digital form ordinarily involves rounding.
Quantization also forms the core of essentially all lossy compression algorithms.

The difference between an input value and its quantized value (such as round-off error) is
referred to as quantization error. A device or algorithmic function that performs quantization is
called a quantizer. An analog-to-digital converter is an example of a quantizer. As an example,
rounding a real numberto the nearest integer value forms a very basic type of quantizer – a
uniform one. A typical (mid-tread) uniform quantizer with a quantization step size equal to some
value can be expressed as where the notation denotes the floor function.

His essential property of a quantizer is that it has a countable set of possible output values
that has fewer members than the set of possible input values. The members of the set of output
values may have integer, rational, or real values. For simple rounding to the nearest integer, the
step sizeis equal to 1. With or equal to any other integer value, this quantizer has real-valued
inputs and integer-valued outputs. When the quantization step size (Δ) is small relative to the
variation in the signal being quantized, it is relatively simple to show that the mean squared error
produced by such a rounding operation will be approximately .[1][2][3][4][5][6] Mean squared error is
also called the quantization noise power. Adding one bit to the quantizer halves the value of Δ,

58
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

which reduces the noise power by the factor ¼. In terms of decibels, the noise power change is
Because the set of possible output values of a quantizer is countable, any quantizer can be
decomposed into two distinct stages, which can be referred to as the classification stage (or
forward quantization stage) and the reconstruction stage (or inverse quantization stage), where
the classification stage maps the input value to an integer quantization indexand the
reconstruction stage maps the index to the reconstruction valuethat is the output approximation
of the input value. For the example uniform quantizer described above, the forward quantization
stage can be expressed as and the reconstruction stage for this example quantizer is simply.

This decomposition is useful for the design and analysis of quantization behavior, and it
illustrates how the quantized data can be communicated over a communication channel – a
source encoder can perform the forward quantization stage and send the index information
through a communication channel, and a decoder can perform the reconstruction stage to
produce the output approximation of the original input data. In general, the forward quantization
stage may use any function that maps the input data to the integer space of the quantization index
data, and the inverse quantization stage can conceptually (or literally) be a table look-up
operation to map each quantization index to a corresponding reconstruction value. This two-
stage decomposition applies equally well to vector as well as scalar quantizers.

Quantization is the process of mapping a set of continuous-valued samples into a smaller,


finite number of output levels. Quantization is of two basic types – (a) scalar quantization and (b)
vector quantization.

Lloyd-Max quantizers described above perform non-uniform quantization if the pdf of


the input variable is not uniform. This is expected, since we should perform finer quantization
(that is, the decision levels more closely packed and consequently more number of reconstruction
levels) wherever the pdf is large and coarser quantization (that is, decision levels widely spaced
apart and hence, less number of reconstruction levels), wherever pdf is low. In contrast, the
reconstruction levels are equally spaced in uniform quantization, i.e.,

Where θ is a constant that is defined as the quantization step-size. In case, the pdf of the
input variable s is uniform in the interval [A, B], i.e.

the design of Lloyd-Max quantizer leads to a uniform quantizer, where

59
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

If the pdf exhibits even symmetric properties about its mean, e.g., Gaussian and
Laplacian distributions, then the decision and the reconstruction levels have some symmetry
relations for both uniform and non-uniform quantizers, as shown in Fig.6.1 and Fig.6.2 for some
typical quantizer characteristics (reconstruction vels vs. input variable s) for L even and odd
respectively.

When pdf is even symmetric about its mean, the quantizer is to be designed for only
L/2levels or (L-1)/2 levels, depending upon whether L is even or odd, respectively.

Circuit diagram:

V01 V02

Procedure:

60
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

1. Connect the circuit as shown in circuit diagram.


2. Apply the input from the Dual regulated power supply to comparator circuit.
3. The comparator will compare the voltages give the outputs of comparator as input to
AND gate.
4. Observe the output waveform in CRO or Digital Multimeter.
5. Changing the input values from Dual regulated power supply and note down the readings
through Digital Multimeter.

Waveforms:
Process of Quantization of an Analog Signal

Calculation Table:

Vin(Input voltage) V01(1st Output) V02(2nd Output)

Precautions:

61
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

1. Loose connections are avoided.


2. Do not disturb the circuit while doing the experiment.
3. Equipment must be handle properly.
4. Apply the specified voltage with proper ground.
5. Check the connections before switching ON supply.
6. Switch off the power supply after completing experiment.

Result:

62
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENT NO-11
PULSE CODE MODULATION

AIM: To generate pulse code modulated signals.


APPARATUS REQUIRED:
Name of the Specifications/Range Quantity
component/Equipment
Op amp IC741 04
Resistor 10kΩ,1kΩ,470Ω 06
IC 7404,7408 03
CRO TDS1002C- 02
EDU,DPO4102B,DS1054Z
Function Generator Scientech 415 02
(10MHz),RIGOL
DG1022(20MHz/100MSa/s)
Fixed Power Supply +5v/-5v 01
BJT BC 547,BC548 01
CAPACITOR 10nf 01

Theory:
Pulse Code modulation come under digital communication technique. In PCM the
message signal is represented by a sequence of coded pulse which accomplished by representing
the signal in discrete form in both time and amplitude. PCM consist of a receiver and transmitter
part. Transmitter section consists of sampler, quantizer, encoder and parallel to serial converter.

Modulation is the process of varying one or more parameters of a carrier signal in


accordance with the instantaneous values of the message signal. The message signal is the signal
which is being transmitted for communication and the carrier signal is a high frequency signal
which has no data, but is used for long distance transmission. There are many modulation
techniques, which are classified according to the type of modulation employed. Of them all, the
digital modulation technique used is pulse code modulation PCM

A signal is pulse code modulated to convert its analog information into a binary
sequence, i.e., 1s and 0s. The output of a PCM will resemble a binary sequence. The following
figure shows an example of PCM output with respect to instantaneous values of a given sine
wave. Instead of a pulse train, PCM produces a series of numbers or digits, and hence this
process is called asdigital. Each one of these digits, though in binary code, represent the
approximate amplitude of the signal sample at that instant.In Pulse Code Modulation, the
message signal is represented by a sequence of coded pulses. This message signal is achieved by
representing the signal in discrete form in both time and amplitude.

63
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

Basic Elements of PCM

The transmitter section of a Pulse Code Modulator circuit consists of Sampling,


Quantizing and Encoding, which are performed in the analog-to-digital converter section. The
low pass filter prior to sampling prevents aliasing of the message signal.The basic operations in
the receiver section are regeneration of impaired signals, decoding, and reconstruction of the
quantized pulse train. Following is the block diagram of PCM which represents the basic
elements of both the transmitter and the receiver sections.

Low pass filter

64
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

This filter eliminates the high frequency components present in the input analog signal
which is greater than the highest frequency of the message signal, to avoid aliasing of the
message signal.

Sampler

This is the technique which helps to collect the sample data at instantaneous values of
message signal, so as to reconstruct the original signal. The sampling rate must be greater than
twice the highest frequency component W of the message signal, in accordance with the
sampling theorem.

Quantizer

Quantizing is a process of reducing the excessive bits and confining the data. The
sampled output when given to Quantizer reduces the redundant bits and compresses the value.

Encoder

The digitization of analog signal is done by the encoder. It designates each quantized
level by a binary code. The sampling done here is the sample-and-hold process. These three
sections lpf, sampler, and quantizer will act as an analog to digital converter.

BLOCK DIAGRAM:

65
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

Circuit diagram:

Procedure:

66
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

1. Connect the circuit as shown in circuit diagram.


2. Apply the input from the Fixed power supply and Function Generator to circuit.
3. Firstly, the output of sampling circuit can be obtained.
4. Secondly, the output of Quantizer can be obtained.
5. Thirdly, the output of Encoder can be obtained
6. Observe the output waveform in CRO or Digital Multimeter.
7. Changing the input values from Function Generator and note down the readings through
Digital Multimeter or CRO.

EXPECTED WAVEFORMS:-

PRECAUTIONS:-
1. Loose connections are avoided.

67
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

2. Do not disturb the circuit while doing the experiment.


3. Equipment must be handling properly.
4. Apply the specified voltage with proper ground.
5. Check the connections before switching ON supply.
6. Switch off the power supply after completing experiment.

OBSERVATIONS:
Message Signal:

Amplitude in Time in Frequency in

PCM Signal:

Amplitude in ON Time in OFF Time in Frequency in

RESULT: The pcm signal is obtained

68
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENT NO-12
ASK, PSK, FSK, QPSK Modulation and Demodulation

AIM: To study ASK, PSK, FSK, QPSK modulator and demodulator circuits and to observe the
waveforms.

APPARATUS REQUIRED:

Name of the Specifications/Range Quantity


component/Equipment
Transistor BC547,BC558 05
Diode IN4007 01
Resistor 10kΩ,3KΩ,1kΩ,500Ω 20
Capacitor 1uF 01
OpAmp IC741 04
CRO TDS1002C- 01
EDU,DPO4102B,DS1054Z
Function Generator Scientech 415 (10MHz),RIGOL 01
DG1022(20MHz/100MSa/s)
FPS +12v,-12V,+5V,-5V,0V 01

THEORY:
Quite often we have to send digital data through analog transmission media such as a
telephone network. In such situations it is essential to convert digital data to analog signal. Basic
approach is shown in Fig. 2.6.1. This conversion is accomplished with the help of special devices
such as modem (modulator-demodulator) that converts digital data to analog signal and vice
versa.

Since modulation involves operations on one or more of the three characteristics of the
carrier signal, namely amplitude, frequency and phase, three basic encoding or modulation
techniques are available for conversion of digital data to analog signals as shown in Fig. 2.6.2.
The three techniques, referred to as amplitude shift keying (ASK), frequency shift keying (FSK)
and phase shift keying (PSK), are discussed in the following sections of this lesson. There are
many situations where ASK and PSK techniques are combined together leading to a modulation
technique known as Quardrature Amplitude Modulation (QAM). In this lesson, these modulation
techniques are introduced.

69
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

The signal set can be shown geometrically in Fig. 2.6.8. This representation is called a
constellation diagram, which provides a graphical representation of the complex envelope of
each possible symbol state. The x-axis of a constellation diagram represents the in-phase
component of the complex envelope, and the y-axis represents the quadrature component of the
complex envelope. The distance between signals on a constellation diagram indicates how
different the modulation waveforms are, and how well a receiver can differentiate between all
possible symbols in presence of noise.

70
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

M-ary modulation: Instead of just varying the phase, frequency or amplitude of the RF
signal, modem modulation techniques allow both envelope (amplitude) and phase (or frequency)
of the RF carrier to vary. Because the envelope and phase provide two degrees of freedom, such
modulation techniques map baseband data into four or more possible RF carrier signals. Such
modulation techniques are known as M-ary modulation. In M-ary modulation scheme, two or
more bits are grouped together to form symbols and one of possible signals S1(t), S2(t), ..., Sm(t)
is transmitted during each symbol period Ts. Normally, the number of possible signals is M = 2n,
where n is an integer. Depending on whether the amplitude, phase or frequency is varied, the
modulation is referred to as M-ary ASK, M-ary PSK or M-ary FSK, respectively. M-ary
modulation technique attractive for use in band limited channels, because these techniques
achieve better bandwidth efficiency at the expense of power efficiency. For example, an 8-PSK
technique requires a bandwidth that is log28 = 3 times smaller than 2-PSK (also known as
BPSK) system. However, M-ary signaling results in poorer error performance because of smaller
distances between signals in the constellation diagram. Several commonly used M-ary signaling
schemes are discussed below.

QPSK: For more efficient use of bandwidth Quadrature Phase-shift Keying (QPSK) can be used,
where

Amplitude Shift Keying (ASK) is a digital modulation scheme where the binary data
istransmitted using a carrier signal with two different amplitude levels. For binary 0 and 1,
thecarrier switches between these two levels. In its simplest form, a carrier is sent during one
inputand no carrier is sent during the other. This kind of modulation scheme is called on-off
keying.A simple ASK modulator circuit is shown in figure. Here a sinusoidal high
frequencycarrier signal is sent for logic ‘0’ (-5V) and no carrier is sent for logic ‘1’ (+5V). The
transistorworks as a switch closes when the input (base) voltage is +5V (logic ‘1’) and shorts the
output.When the input voltage is -5V (logic ‘0’), the switch opens and the carrier signal is
directlyconnected to the output.
Frequency Shift Keying (FSK) is a digital modulation scheme where the digital data
istransmitted using a high frequency carrier signal. For logic ‘0’ and ‘1’ the carrier signal
switchesbetween two preset frequencies, hence the name FSK.

71
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

Binary Phase Shift Keying (BPSK) is digital transmission scheme where the binary datais
transmitted using out of phase signals. During logic ‘0’ a preset number of cycles of asinusoidal
carrier signal is transmitted and during logic ‘1’ the same number of cycles of thecarrier signal is
transmitted but with 180o phase shift.
QPSK is a form of phase modulation technique, in which two information bits (combined
as one symbol)are modulated at once, selecting one of the four possible carrier phase shift states.
Recall that in binary PSK (BPSK), the change in logic levelcauses the BPSK signal’s phase to
change; it does so by 180o.Figure 1 illustrates a BPSK signal (lower), together with the
modulating binary sequence (upper).

A QPSK signal can be generated by independently modulating two carriers in quadrature


as 2At the input to the modulator, the digital data’s even bits (that is, bits 0, 2, 4 and so on) are
stripped from the data stream by a “bit-splitter” and are multiplied with a carrier to generate a
BPSK signal (called PSKI). Atthe same time, the data’s odd bits (that is, bits 1, 3, 5 and so on)
are stripped from the data stream and are multiplied with the 90°phase-shifted carrier to generate
a second BPSK signal (called PSKQ). The two BPSK signals are then simply added together for
transmission. Figure 3 illustrates thisprocedure to generate a QPSK signal.

The 90º phase separation between the carriers allows the sidebands to be separated by the
receiver using phase discrimination. Figure 4shows the block diagram of the mathematical
implementation of QPSK demodulation.

Notice the arrangement uses two product detectors to simultaneously demodulate the two
BPSK signals. This simultaneously recovers the pairs of bits in the original data. The two signals
are cleaned-up using a comparator or some other signal conditioner then the bits is put back in
order using a 2-bit parallel-to-serial converter.

BLOCK DIAGRAM:

ASK Modulator:

72
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

FSK Modulator:

PSK Modulator:

QPSK Modulator:

73
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

ASK Demodulator:

PSK Demodulator:

FSK Demodulator:

74
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

QPSK Demodulator:

CIRCUIT DIAGRAM:

Ask Modulator:

75
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

ASK Demodulator:

PSK Modulator:

76
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

PSK Demodulator:

FSK Modulator:

77
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

FSK Demodulator:

QPSK Modulator:

78
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

QPSK Demodulation:

PROCEDURE:
ASK Modulator:
1. Connect the circuit as shown in circuit diagram.

2. Apply Message signal as Digital data (1KHz frequency,5Vpp amplitude) is given input
to the base terminal of BJT and Carrier signal (10KHz frequency,5Vpp) is given input to the
collector terminal of the BJT
3. Output is observed at Emitter terminal of the BJT.
ASK Demodulator:
1. Connect the circuit as shown in circuit diagram.
2. ASK modulation output is given input to the Asynchronous detector
3. Here R,C values are calculated using this formula is 1/fc<RC<1/fm condition.
4. And that values are submitting above circuit and that output like as Digital data or
message signal.
5. Observe the digital signal at ASK demodulator circuit.

PSK Modulator:
1. Connect the circuit as shown in circuit diagram.
2. Apply Message signal as Digital data (1KHz frequency,5Vpp amplitude) is given input to
the base terminal of BJT and Carrier signal (10KHz frequency,5Vpp) is given input to the
collector terminal of the BJT
3. Another carrier signal (10KHz frequency,1Vpp)is given to input of the emitter terminal of
the pnp transistor.
4. Outputs are observed collector terminal of NPN BJT and emitter terminal of PNP BJT.
5. These two outputs are subtraction through OP AMP it’s given Phase shift keying output.

PSK Demodulator:
1. Connect the circuit as shown in circuit diagram.
2. Psk modulation output is given input to the subtraction of OPAMP , here another input is
base carrier signal.
3. Here OPAMP output is given to the Asynchronous detector.
4. That output is same like as message signal.

79
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

FSK Modulator:
1. Connect the circuit as shown in circuit diagram.
2. Apply Message signal as Digital data (1KHz frequency,5Vpp amplitude) is given input
to the base terminal of BJT and Carrier signal (10KHz frequency,4Vpp) is given input to the
collector terminal of the NPN BJT
3. Another carrier signal (5KHz frequency,4Vpp)is given input to emitter terminal of PNP
BJT.
4. And these two output are given to the input of inverting summer of OPAMP.
5. That OPAMP output is frequency shift keying.

FSK Demodulator:
1. Connect the circuit as shown in circuit diagram.
2. Fsk signal is given to input of high pass filter .
3. HPF output is feed to Asynchronous detector.
4. Detector output like as message signal.

QPSK Modulator:
1. Connect the circuit as shown in circuit diagram.
2. Apply Message signal as Digital data f1 (1KHz frequency,5Vpp amplitude) is given
input to the base terminal of BJT at first PSK block and Carrier signal (10KHz frequency,4Vpp)
is given input to the collector terminal of the NPN BJT
3. And same carrier signal is given input to the emitter terminal of the PNP BJT.
4. And these two outputs are feed to the subtraction opamp .
5. Above procedure applied to 2ndpsk block.
6. Both opamp outputs are given input to subtraction opamp.
7. Opamp output is quadrature phase shift keying.

QPSK Demodulator:
1. Connect the circuit as shown in circuit diagram.
2. QPSK input signal is given QPSK demodulator .
3. QPSK demodulator output is given low pass filter .
4. LPF output is feed to voltage comparator.
5. Voltage comparator output is given differential digit decoder.
6. Decoder output is like as message signal.

PRECAUTIONS:-
1. Loose connections are avoided.
2. Do not disturb the circuit while doing the experiment.
3. Equipment must be handling properly.
4. Apply the specified voltage with proper ground.
5. Check the connections before switching ON supply
6. Switch off the power supply after completing experiment.

80
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPECTED WAVE FORMS:

Ask modulated wave:

PSK Modulated wave:

FSK Modulator:

81
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

QPSK Modulator:

Demodulation waveform:

TABULARFORMS:
INPUT DATA:
Amplitude in ON Time in OFF Time in

82
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

CARRIER SIGNAL:
Amplitude in Time in Frequency in

MODULATED SIGNAL:
Amplitude in Time in Frequency in

DEMODULAED SIGNAL

Amplitude in ON Time in OFF TIME in

RESULT: The ASK, FSK, PSK and QPSK modulated output waveform is obtained and it is
Justified with theoretical calculation.

83
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENT-13
DECODING OF CORRUPTED REPETITION CODE.
AIM: To write and simulate program of the decoding of corrupted repetition code for bpsk
signal.
APPARATUS REQUIRED:

Name of the Software Specifications/Range Quantity


MATLAB 2018a 01

THEORY:
A code is a mapping that takes a sequence of information symbols and produces a
(larger) sequence of code symbols so as to be able to detect/correct errors in the transmission of
the symbols. The simplest class of codes is the class of binary linear block codes. Here each
vector of k information
Bits xi = [xi,1 . . . xi,k] is mapped to vector of n code bits ci = [ci,1 . . . ci, n], with n > k.
The rate R of the code is defined to be the ratio k/n.
A binary linear block code can be defined in terms of a k × n generator matrix G with binary
entries such that the code vector ci corresponding to an information vector xi is given by:

ci = xi G

Repitition Codes. A rate-n1 repitition code is defined by codebook:0 7→ [0 0. . . 0] ,


and1 7→ [1 1. . . 1] (4)The minimum distance of this code is n and hence it can correct ⌊n-2 1⌋
errors. The optimum decoder for this code is simply a majority logic decoder. A rate-1 2
repitition code can detect one error, but cannot correct any errors. A rate-1 3 repitition code can
correct one error.
The repetition code can correct a superposition of errors. This is more realistic than
depending on an error fecting only one qubits. It also illuminates some quantum behaviors. Like
any other quantum state, the error may be a superposition, such as
(0.8x⊗i⊗i+0.2i⊗x⊗i)(a|000〉+b|111〉).

Informally the first factor may be read as, if we measured the state, we having an 80%
chance of finding the first qubit flipped and a 20% chance of finding the second qubit flipped.
Multiplying the error state is

|Ψ〉=(0.8X⊗I⊗I+0.2I⊗X⊗I)(a|000〉+b|111〉)

=0.8(a|100〉+b|011〉)+0.2(a|010〉+b|101〉)

The error state is then augmented with |000〉 and the syndrome extraction, S, applied:

S(|Ψ〉⊗|000〉)=S(0.8(a|100000〉+b|011000〉)+0.2(a|010000〉+b|101000〉))

84
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

=0.8(a|100110〉+b|011110〉)+0.2(a|010101〉+b|101100〉)
=0.8(a|100〉+b|011〉)⊗|110〉+0.2(a|010〉+b|101〉)⊗|111〉.

Now we measure the last three qubits. This measurement collapses them to |110〉 with
80% probability or |101〉 with 20% probability. Since they are entangled with the repetition
coding bits, the coding bits partially collapse, too. The final state is (a|100〉 + b|100〉) ⊗ |11〉
with 80% probability or (a|010〉 + b|101〉) with 20% probability. If we measured 1, 1, 0, the
first collapse took place, and we apply X⊗I⊗I to a|100〉 + b|011〉, producing a|000〉 + b|111
〉, the original coding. On the other hand, if we measured 1, 0, 1, we apply I⊗X⊗I to a|010〉
+ b|101〉. In either case, the system is restored to the original condition, a|000〉 + b|111〉,
without ever measuring (or disturbing) the repetition bits themselves.

This error correction model works only if no more than one of the three qubits
experiences an error. With an error probability of p, the chance of either no error or one error is
(1 − p)3 + 3p (1 − p)2 = 1 − 3p2 + 2p3. This method improves system reliability if the chance of
an uncorrectable error, which is 3p2 − 2p3, is less than the chance of a single error, p, in other
words, if p< 0.5.

Among the simplest codes are repetition codes, where each codeword consists of a single
symbol repeated several times. The length-n repetition code over A is therefore the (n, 1) code
a…a︸n:a∈A.

For example, the length-4 repetition code over {0, 1, 2} is

0000,1111,2222.

Length-n repetition code have the highest possible minimum distance—n, hence can correct
[n−12] errors. However their size, |A|, is independent of n, hence their rate, log |A|/n diminishes
as the block length increases. They are therefore best used for examples.

The binary single parity check codes consist of all binary strings with an even number of 1's. For
example, the length-4 code is

0000, 0011, 0101, 0110, 1001,1010,1100,1111.

Single parity codes are (n, n − 1) codes each with minimum distance of 2, hence cannot correct
any error. They are, however, useful for error detection. The receiver can detect if a single error
has occurred and ask for retransmission.

PROGRAM:
clc;
close all;
N=input('enter number of data bits you want to transmit (atleast 10^5): ');
k=input('enter repetition code length (odd number): ' );
85
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

noise_power=linspace(2,0.1,20);
L=length(noise_power);
P_error_uncoded=zeros(1,L);
P_error_coded=zeros(1,L);
x=randi([0,1],1,N)-0.5;
x_tx=sign(x);
for l=1:L
noise=sqrt(noise_power(l))*randn(1,N);
y_r=x_tx+noise;
y_d=sign(y_r);
temp1=y_d-x_tx;
temp2=abs(temp1/2);
Errors_count=sum(temp2);
P_error_uncoded(l)=Errors_count/N
%With Repetitive coding
y_r_r=zeros(k,N);
for k1=1:k
noise=sqrt(noise_power(l))*randn(1,N);
y_r_r(k1,:)=x_tx+noise;
end
y_d_r=sign(y_r_r);
temp3=sum(y_d_r);
x_decoded=sign(temp3);
temp4=x_decoded-x_tx;
temp5=abs(temp4/2);
Errors_count1=sum(temp5);
P_error_coded(l)=Errors_count1/N
end
figure;
plot(noise_power,P_error_uncoded);
figure;
plot(noise_power,P_error_coded);
SNR=1./noise_power;
figure;
plot(SNR,P_error_uncoded);
hold on;
plot(SNR,P_error_coded);
xlabel('SNR');
ylabel('Error Probability');
legend('uncoded','coded');
86
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

PROCEDURE:
1. Initialization commands
2. Generate bpsk signal.
3. Calculate noise of the bpsk signal.
4. Generate bpsk modulated signal.
5. Generate repetation code for bpsk signal.
6. Decoding of bpsk repetation code signal.
7. Plot the Graph of Error Probability Vs SNR.

EXPECTED WAVEFORMS:

PRECAUTIONS:-1
1. Write the program with specific conditions.
2. Execute the program and find out the errors and solve it again execute until without errors.
3. Observe the curves for respective program.
4. Shutdown the system after execution of program.

RESULT:

87
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENT NO-14
TIME DIVISION MULTIPLEXING
AIM: To obtain time division multiplexed signal from different channel and make it to
Transmit in a single channel.

APPARATUS REQUIRED:

Name of the Specifications/Range Quantity


component/Equipment
Transistor BC547,BC558 02
Resistor 10kΩ,1kΩ 06
OpAmp IC741 01
CRO TDS1002C- 01
EDU,DPO4102B,DS1054Z
Function Generator Scientech 415 (10MHz),RIGOL 01
DG1022(20MHz/100MSa/s)
FPS +12v,-12V,+5V,-5V,0V 01

THEORY:
It has been observed that most of the individual data-communicating devices typically
require modest data rate. But, communication media usually have much higher bandwidth. As a
consequence, two communicating stations do not utilize the full capacity of a data link.
Moreover, when many nodes compete to access the network, some efficient techniques for
utilizing the data link are very essential. When the bandwidth of a medium is greater than
individual signals to be transmitted through the channel, a medium can be shared by more than
one channel of signals. The process of making the most effective use of the available channel
capacity is called Multiplexing. For efficiency, the channel capacity can be shared among a
number of communicating stations just like a large water pipe can carry water to several separate
houses at once. Most common use of multiplexing is in long-haul communication using coaxial
cable, microwave and optical fibre.
Figure 2.7.1 depicts the functioning of multiplexing functions in general. The multiplexer is
connected to the demultiplexer by a single data link. The multiplexer combines (multiplexes)
data from these ‘n’ input lines and transmits them through the high capacity data link, which is
being demultiplexed at the other end and is delivered to the appropriate output lines. Thus,
Multiplexing can also be defined as a technique that allows simultaneous transmission of
multiple signals across a single data link.

88
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

Multiplexing techniques can be categorized into the following three types: •Frequency-division
multiplexing(FDM): It is most popular and is used extensively in radio and TV transmission.
Here the frequency spectrum is divided into several logical channels, giving each user exclusive
possession of a particular frequency band.
Time-division Multiplexing (TDM): It is also called synchronous TDM, which is commonly
used for multiplexing digitized voice stream. The users take turns using the entire channel for
short burst of time. •Statistical TDM: This is also called asynchronous TDM, which simply
improves on the efficiency of synchronous TDM.
Time-Division Multiplexing (TDM)
In frequency division multiplexing, all signals operate at the same time with different
frequencies, but in Time-division multiplexing all signals operate with same frequency at
different times. This is a base band transmission system, where an electronic commutator
sequentially samples all data source and combines them to form a composite base band signal,
which travels through the media and is being demultiplexed into appropriate independent
message signals by the corresponding commutator at the receiving end. The incoming data from
each source are briefly buffered. Each buffer is typically one bit or one character in length. The
buffers are scanned sequentially to form a composite data stream. The scan operation is
sufficiently rapid so that each buffer is emptied before more data can arrive. Composite data rate
must be at least equal to the sum of the individual data rates. The composite signal can be
transmitted directly or through a modem. The multiplexing operation is shown in Fig. 2.7.7

As shown in the Fig 2.7.7 the composite signal has some dead space between the
successive sampled pulses, which is essential to prevent interchannel cross talks. Along with the
sampled pulses, one synchronizing pulse is sent in each cycle. These data pulses along with the
control information form a frame. Each of these frames contain a cycle of time slots and in each
frame, one or more slots are dedicated to each data source. The maximum bandwidth (data rate)
of a TDM system should be at least equal to the same data rate of the sources.
Synchronous TDM is called synchronous mainly because each time slot is preassigned to
a fixed source. The time slots are transmitted irrespective of whether the sources have any data to
send or not. Hence, for the sake of simplicity of implementation, channel capacity is wasted.
Although fixed assignment is used TDM, devices can handle sources of different data rates. This

89
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

is done by assigning fewer slots per cycle to the slower input devices than the faster devices.
Both multiplexing and demultiplexing operation for synchronous TDM are shown in Fig. 2.7.8.

An important feature of pulse-amplitude modulation is a conservation of time. That is, for


a given message signal, transmission of the associated PAM wave engages the communication
channel for only a fraction of the sampling interval on a periodic basis. Hence, some of the time
interval between adjacent pulses of the PAM wave is cleared for use by the other independent
message signals on a time-shared basis. By so doing, we obtain a time-division multiplex system
(TDM), which enables the joint utilization of a common channel by a plurality of independent
message signals without mutual interference. Each input message signal is first restricted in
bandwidth by a low-pass pre-alias filter to remove the frequencies that are nonessential to an
adequate signal representation.
Time Division Multiplexing (TDM) is widely used in digital communication networks
totransmit multiple signals simultaneously through the same channel. Different signals
aretransmitted in a time shared manner. Each signal is allotted a fixed time slot and a sample of
thecorresponding signal is transmitted during that period. After one sample each of all the signals
issent, the time slot is given back to the first signal and this process repeats.
A simple TDM multiplexer circuit using an NPN-PNP transistor pair and an Op amp
isshown in figure. The transistors work as switches and the Op amp works as an adder. The
signals to be sent are fed to the collectors of the two transistors. The switching signal is applied
to thebases the transistors. During the ON time of the switching signal, the NPN transistor is ON
andthe PNP transistor is OFF. Signal 1 alone is connected to the adder input and reaches the
output.During OFF time of the switching signal, the NPN transistor is OFF and the PNP
transistor isON. Signal 2 alone is connected to the adder input and reaches the output. Thus the
two signalsreach the output one after the other as the switching signal changes state. The
resulting signal is atime division multiplexed one. The on-off period of the switching signal
decides the time slot.

90
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

BLOCK DIAGRAM:

CIRCUIT DIAGRAM:

91
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

PROCEDURE:
1. Connect the circuit as shown in circuit diagram.
2. Connect 5Vpp, 10KHz square wave signal as the switching input.
3. Connect 3Vpp, 1kHz sine wave as signal 1 and 5Vpp, 1kHz square wave as signal 2.
4. Observe the TDM output on CRO and plot the waveforms.

PRECAUTIONS:-
1. Loose connections are avoided.
2. Do not disturb the circuit while doing the experiment.
3. Equipment must be handle properly.
4. Apply the specified voltage with proper ground.
5. Check the connections before switching ON supply
6. Switch off the power supply after completing experiment.

EXPECTED WAVEFORMS:

TABULAR FORMS:
SIGNALS AMPLITUDE IN TIME IN FREQUENCY IN
Switching signal
Signal1
Signal2

RESULT:Time Division Multiplexing System signal has been verified & observed
successfully.

92
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENT-15
USING MATLAB PLOT THE CONSTELLATION OF BPSK, QPSK
WITHOUT NOISE AND WITH AWGN (UNDER DIFFERENT SNR
VALUES) AND DRAW THE DECISION BOUNDARIES. OBSERVE THE
SYMBOL ERRORS, BIT ERRORS
AIM: To write and simulate programs of the constellation of bpsk and qpsk without noise and
with awgn (under different snr values) in MATLAB software and draw the decision boundaries.
Observe the symbol errors, bit errors

APPARATUS REQUIRED:

Name of the Software Specifications/Range Quantity


MATLAB 2018a 01

THEORY:
Constellation Diagram of BPSK The simplest form of PSK is binary phase-shift keying
(BPSK), where N = 1 and M = 2.Therefore, with BPSK, two phases (21 = 2) are possible for
the carrier. One phase represents a logic 1, and the other phase represents a logic 0. As the
input digital signal changes state (i.e., from a1 to a 0 or from a 0 to a 1), the phase of the output
carrier shifts between two angles that are separated by 180 degres.
Bpsk (also sometimes called prk, phase reversal keying, or 2psk) is the simplest form of
phase shift keying (psk). It uses two phases which are separated by 180° and so can also be
termed 2-psk. It does not particularly matter exactly where the constellation points are
positioned, and in this figure they are shown on the real axis, at 0° and 180°. Therefore, it
handles the highest noise level or distortion before the demodulator reaches an incorrect
decision. That makes it the most robust of all the psks. It is, however, only able to modulate at
1 bit/symbol (as seen in the figure) and so is unsuitable for high data-rate applications. In the
presence of an arbitrary phase-shift introduced by the communications channel, the
demodulator (see, e.g. Costas loop) is unable to tell which constellation point is which. As a
result, the data is often differentially encoded prior to modulation. Bpsk is functionally
equivalent to 2-qam modulation.
One way to view magnitude and phase is with the use of a polar diagram (Fig. 1). In a
polar diagram, magnitude is represented by the distance of the point from the origin, while the
phase is represented by the angle from the horizontal axis to the line formed from the origin to
the point. Conveniently, digital modulation schemes employ the use of an I/Q diagram. An I/Q
diagram is simply a diagram using a rectangular coordinate system superimposed on a polar
diagram representing the same set of a data (i.e. Magnitude and phase). The I/Q values translate
magnitude and phase information of a signal into a simple rectangular, linear set of values

93
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

which simplify the associated signal processing.


The benefits of viewing digitally modulated signals in the rectangular I/Q format are
quickly realized when it is understood that nearly all digitally modulated signals rely on I/Q
signals created by an I/Q modulator.

I/Q Data and Constellation Diagrams

Most digital modulation schemes involve a discrete number of symbols which are used to
convey information. These symbols are mapped to a discrete set of magnitude and phase values
on the I/Q plane, which are referred to as constellation points. Modulation schemes with greater
numbers of constellation points are able to transmit more information per symbol, as the more
symbols there are in a given modulation scheme, the greater number of bits a single symbol can
represent [1]. For example, in binary phase-shift keying (BPSK) each symbol can only represent
a 0 or a 1 because it has just two constellation points, therefore transmitting just one bit per
symbol. Quadrature phase-shift keying (QPSK), which has four constellation points, can
represent 00, 01, 10, or 11, and can therefore transmit 2 bits per symbol.
This relationship can be expressed by the following equation:
M = 2n, where M = # of constellation points
n = bits/symbol or n = log2(M)
Therefore, theoretically QPSK can transmit twice as much data using the same amount of
bandwidth as BPSK, or it could transmit the same amount of data using half the bandwidth. The
tradeoff, however, is that there is less tolerance in the system for error (in terms of magnitude
and phase) [1]. To better understand this, recall that in BPSK there are only two constellation
points, meaning that the entire I/Q plane is separated into just two sections with the decision
boundary located on the Q-axis. This means that a received I/Q value could be 89° out-of-phase,
but the intended symbol could still be correctly interpreted because the received symbol falls
within the correct decision boundary (represented in Fig. 5). However, in QPSK, the I/Q plane is
separated into four sections, with decision boundaries at both the I- and Q-axes, leaving less
margin for error. In QPSK, a symbol that is received 89° out-of-phase would be incorrectly
interpreted by the receiver and would result in a symbol error.
Polar diagrams are used to display the instantaneous value of the carrier signal at any point in
time. This includes the values recorded at each symbol-clock transition, as well as the transition
pathways between each decision point. In practice, a signal’s instantaneous value is typically
unimportant unless the transition pathways between decision points are required to better
understand the root cause of a dominant error mode. Instead, what is generally of importance are
key decision points which are aligned with the symbol clock. With each cycle of the symbol
clock, it is expected that the signal’s I/Q or magnitude/phase values will be aligned with a
corresponding constellation point for the given modulation scheme. The amplitude and phase
values captured at these decision points are what is displayed on a constellation diagram.

PROGRAM:

clc;
clear all;
close all;
%****************************Message Signal********************************

94
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

N=100; %Number of 1 and 0


data = randi([0 1],N,1); %Getting 1 and 0 randomly
%data representing at NZR
data_NZR = 2*data-1; % representing 1 as 1 and 0 as -1
s_p_data = reshape(data_NZR,1,length(data)); %Reshaping as 1 bits in array
bit_rate = 10.^3;
f = bit_rate; %minimum carrier frequency
Tb = 1/bit_rate ; %bit duration
t = 0:(Tb/99):Tb ; %Time vector for one bit information
%****************************BPSK Modulation*******************************
x_mod = [];
Ac = 1;
xc = Ac*cos(2*pi*f*t);
for (l=1:length(data))
xc = s_p_data(1,l)*Ac*cos(2*pi*f*t);
x_mod = [x_mod xc]; %Modulated signal
end
M = 2; % MOD is BPSK therefor M = 2
x_mod_const = []; % Constellation points of the Modulated signal
for (n=1:length(data))
if s_p_data(1,n) == 1 %point 1
xC = exp(-i*((2*pi*0)/M))
elseifs_p_data(1,n) == -1 %point 0
xC = exp(-i*((2*pi*1)/M))
end
x_mod_const = [x_mod_constxC];
end
Tx = x_mod; %Transmitting Data
Tx_const = x_mod_const; %Constellation of Tx
%********************************AWGN**************************************
%Adding White Gaussian Noise to Transmitting Signal
SNR1db = input('enter required SNR for psk in DB:');
SNR = 10^(SNR1db/10);
%SNR = 100;
Tx_awgn = awgn(Tx,SNR,'measured');
Tx_const_awgn = awgn(Tx_const,SNR,'measured');
Rx = Tx_awgn; %Recieving signal shape
Rx_const = Tx_const_awgn; %Recieving Constellation Diagram
%****************************Visualizing Data******************************
%Constellation Diagram of the Tx
scatterplot(Tx_const,[],[],'g*'); grid minor;
%Constellation Diagram of the Rx
scatterplot(Rx_const,[],[],'r*'); grid minor;
clc;
M = 4;
data = randi([0 M-1],1,N); %Message Infromation

95
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

s = pskmod(data,M,pi/4); %Modulated data (data,M,rotate angle)


SNR1db = input('enter required SNR for qpsk in DB:');
SNR = 10^(SNR1db/10);
r = awgn(s,SNR,'measured');

bit_rate = 10.^3;
f = bit_rate; %minimum carrier frequency
Tb = 1/bit_rate ; %bit duration
t = 0:(Tb/1000):Tb ;
TxSig = [];
for l=1:length(data)
Tx = real(s(l))*cos(2*pi*f*t) + imag(s(l))*sin(2*pi*f*t);
TxSig = [TxSigTx];
end
%Received Signal waveform
RxSig = awgn(TxSig,SNR,'measured'); %AWGN for Tx Waveforms

% %****************************Visualizing Data******************************
%Wave forms of the Signal
figure(4)
subplot(3,1,1);
stairs(data); grid minor; ylim([-0.5,M-0.5]); xlim([0,N]);
title('Message Signal');
subplot(3,1,2);
plot(TxSig); grid minor; title('QPSK Modulated Signal');
ylim([-1.5,1.5]); xlim([0,N*10^3+N]);
subplot(3,1,3);
plot(RxSig); grid minor; title('QPSK Modulated Signal with AWGN');
xlim([0,N*10^3+N]);
% Constellation Diagram of the Rx
scatterplot(r); grid minor;
title('Constellation Diagram of QPSK')

PROCEDURE:
Algorithm
Initialization commands

BPSK AND QPSK modulation


1. Generate message signal.
2. Generate carrier signal.
3. Start FOR loop
4. Generate modulated signal.
5. Given SNR values
6. Generate AWGN niose .
7. End FOR loop.

96
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

BPSK AND QPSK de modulation


1. Generate demodulated signal using AWGN noise.

BPSK AND QPSK constellation diagrams


1. Plot the constellation of bpsk and qpsk signals.
To execute the program and find out errors and modified it again execute the program until
without errors.

EXPECTED WAVEFORMS:
Constellation of Transmitted psk signal

Constellation of Received psk signal

97
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

Transmitted qpsk signal with AWGN noise

Constellation of Received qpsk signal

98
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

PRECAUTIONS:-
1. Write the program with specific conditions.
2. Execute the program and find out the errors and solve it again execute until without errors.
3. Observe the curves for respective program.
4. Shutdown the system after execution of program.

RESULT:

99
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENT-16
USING MATLAB MONTE-CARLO SIMULATIONS, TO FIND THE BER
VERSUS SNR CURVES FOR ASK, BPSK, FSK, QPSK, 16PSK,16QAM
WITH AWGN CHANNEL.
AIM: To write and simulate programs of ASK, BPSK, FSK, QPSK, 16PSK and 16QAM in
MATLAB Software. And observe the curves of BER versus SNR values with AWGN channel.

APPARATUS REQUIRED:

Name of the Software Specifications/Range Quantity


MATLAB 2018a 01

THEORY:
Amplitude Shift Keying (ASK) is a digital modulation scheme where the binary data is
transmitted using a carrier signal with two different amplitude levels. For binary 0 and 1, the
carrier switches between these two levels. In its simplest form, a carrier is sent during one input
and no carrier is sent during the other. This kind of modulation scheme is called on-off keying. A
simple ASK modulator circuit is shown in figure. Here a sinusoidal high frequency carrier signal
is sent for logic ‘0’ (-5V) and no carrier is sent for logic ‘1’ (+5V). The transistor works as a
switch closes when the input (base) voltage is +5V (logic ‘1’) and shorts the output. When the
input voltage is -5V (logic ‘0’), the switch opens and the carrier signal is directly connected to
the output.
Frequency Shift Keying (FSK) is a digital modulation scheme where the digital data is
transmitted using a high frequency carrier signal. For logic ‘0’ and ‘1’ the carrier signal switches
between two preset frequencies, hence the name FSK.
Binary Phase Shift Keying (BPSK) is digital transmission scheme where the binary data is
transmitted using out of phase signals. During logic ‘0’ a preset number of cycles of a sinusoidal
carrier signal is transmitted and during logic ‘1’ the same number of cycles of the carrier signal
is transmitted but with 180o phase shift.
QPSK is a form of phase modulation technique, in which two information bits (combined as one
symbol) are modulated at once, selecting one of the four possible carrier phase shift states.
Recall that in binary PSK (BPSK), the change in logic level causes the BPSK signal’s phase to
change; it does so by 180o.Figure 1 illustrates a BPSK signal (lower), together with the
modulating binary sequence (upper).

A QPSK signal can be generated by independently modulating two carriers in quadrature as 2At
the input to the modulator, the digital data’s even bits (that is, bits 0, 2, 4 and so on) are stripped
from the data stream by a “bit-splitter” and are multiplied with a carrier to generate a BPSK
signal (called PSKI). At the same time, the data’s odd bits (that is, bits 1, 3, 5 and so on) are
stripped from the data stream and are multiplied with the 90°phase-shifted carrier to generate a
100
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

second BPSK signal (called PSKQ). The two BPSK signals are then simply added together for
transmission. Figure 3 illustrates this procedure to generate a QPSK signal.

The 90º phase separation between the carriers allows the sidebands to be separated by the
receiver using phase discrimination. Figure 4shows the block diagram of the mathematical
implementation of QPSK demodulation.

Notice the arrangement uses two product detectors to simultaneously demodulate the two BPSK
signals. This simultaneously recovers the pairs of bits in the original data. The two signals are
cleaned-up using a comparator or some other signal conditioner then the bits is put back in order
using a 2-bit parallel-to-serial converter.

we can pass data through different channel one by one For AWGN channel AWGN Add
white Gaussian noise to a signal. Y = AWGN(X,SNR) adds white Gaussian noise to X. The SNR
is in dB. The power of X is assumed to be 0 dB W. If X is complex, then AWGN adds complex
noise. Y = AWGN(X, SNR, SIGPOWER) when SIGPOWER is numeric, it represents the signal
power in dB W. When SIGPOWER is 'measured', AWGN measure the signal power before
adding noise. we use the following statement in coding as a awgn function
chan_awgn=sqrt(80/52)*awgn(ser_data,snr(ii),'measured'); % awgn addition For Rayleigh
channel[data_rx]=sqrt(80/52)*channel_rly(ser_data,snr(ii));For Ricean
channel[data_rx]=sqrt(80/52)*channel_ricean(ser_data,snr(ii));At receiver sideS to P:-:
ser_to_para = reshape(data_rx,80,nsym).';Removing cyclic prefix:-cyclic_pre_rem =
ser_to_para(:,[17:80]);FFT_recdata=(sqrt(52)/64)*fftshift(fft(cyclic_pre_rem.')).';rem_pilot=FFT
_recdata(:,[6+[1:nbitpersym/2]7+[nbitpersym/2+1:nbitpersym] ]); ser_data_1 =
reshape(rem_pilot.',nbitpersym*nsym,1); z=modem.pskdemod(2);

BER vs. SNR performance analysis of BPSK, QPSK and 16-QAM modulation technique
over Additive White Gaussian Noise channel. BPSK has lower BER than QPSK and 16QAM.
For example at SNR=2, BER in BPSK is 0.07 where QPSK & 16QAM is around 0.1. At
SNR=12,BPSK, BER=0 but QPSK-BER>10-4 and 16 QAM-BER>10-2.

analysis of BPSK, QPSK and 16-QAM modulation technique over Rayleigh fading
channel. BPSK has lower BER than QPSK and 16QAM. For example at SNR=4, BER in BPSK
is <10-1(0.1) where QPSK & 16QAM is around 0.2. At SNR=12 ,BPSK, BER=0.02 butQPSK-
BER>0.04 and 16 QAM-BER>0.1

BER vs. SNR performance analysis of BPSK, QPSK and 16-QAM modulation technique
over Rician fading channel. Fig. 6 shows performance analysis of BPSK, QPSK and 16-QAM
modulation technique over Rician fading channel. We know that if BER decreases than BER
performance will be increases. In graph as the value of SNR is increases, BER is decreases in all
three modulation technique, that mean for better performance signal to noise ratio must be high
i.e. noise must be low for best communication. Here BER performance of BPSK is better than
QPSK and 16-QAM.Also QPSK is better than 16-QAM. Result is almost same in all channels

101
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

analysis of BPSK, QPSK and 16-QAM modulation technique over Rician fading channel.
In graph as the value of SNR is increases, BER is decreases in all three modulation techniqueis
shown in Table V, that mean for better performance BPSK may preferred.

the performance of OFDM system over different channels has been observed. The
analysis is based on the study of Bit Error Rate (BER) and Signal to Noise Ratio (SNR). Also
explain the design and implementation of OFDM system in terms of operation at transmitter end
and receiver end. To remove the Inter Symbol Interference (ISI), a cyclic prefix addition method
is used here. Also At last we conclude our work with the help of graph. From the results obtained
it is concluded that the BER decreases as the SNR increases. The BPSK has an overall better
performance as compared to QPSK & 16-QAM techniques. That means lower order of
modulation techniques is better to use in communication system if spectral efficiency is not
considered or taken in an account.

three digital modulation schemes have been discussed theoretically and then implemented
them in MATLAB simulation. We have also demodulate the modulated ASK, FSK and PSK and
recovered the original bit stream or message signal. Then the performance (BER vs. Eo/No) of
ASK, FSK and PSK over Additive white Gaussian noise (AWGN) channel has been observed
when bit error rate is zero and when the bit error rate has a high value. The position of error bit in
input bit stream has also been localized and mentioned in the simulation result in the case of
error rate.

let us try to derive the symbol error rate for 16-PSK (16-Phase Shift Keying) modulation.
Consider a general M-PSK modulation, where the alphabets, are used. Let us the consider the
symbol on the real axis, i.e

The received symbol .

Where the additive noise follows the Gaussian probability distribution function,

with and .

The conditional probability distribution function (PDF) of received symbol given was
transmitted is:

102
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

As can be seen from the figure above, due to the addition of noise, the transmitted symbol gets
spreaded. However, if the received symbol is present with in the boundary defined by the
magenta lines, then the symbol will be demodulated correctly.

To derive the symbol error rate, the objective is to find the probability that the phase of the
received symbol lies within this boundary defined by the magenta lines i.e. from to
.For simplifying the derivation, let us make the following assumptions:

(a) The signal to noise ratio, is reasonably high.

For a reasonably high value of , then the real part of the received symbol is not afected by
noise i.e.,

and

the imaginary part of the received symbol is equal to noise, i.e.


.

(b) The value of M is reasonably high (typically M >4 suffice)

For a reasonably high value of M, the constellation points are closely spaced. Given so, the

distance of the constellation point to the magenta line can be approximated as .

Given the above two assumptions, it can be observed that the symbol will be decoded

incorrectly, if the imaginary component of received symbol isgreaterthan . The

probability of being greater than is,

Changing the variable to ,

Note: The complementary error function, .

Similarly, the symbol will be decoded incorrectly, if the imaginary component of received

symbol is less than . The probability of being less than


is,

The total probability of error given was transmittd is,

103
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

Total symbol error rate

The symbol will be in error, if atleast one of the symbol gets decoded incorrectly. Hence the total
symbol error rate from M-PSK modulation is,

PROGRAMS:
clear;

close all;

clc;

%BER of BASK under AWGN


%generate random input bits

N=1000000;

m=randi([0 1],1,N)

%mapping

for i=1:N

if m(i)==0

x(i)=0;

else

x(i)=1;

end

end

ber_sim=[];

ber_theo=[];

for EbNOdB=0:1:15;

EbNO=10^(EbNOdB/10);

sigma=sqrt(1/(2*EbNO));

104
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

%generating guassian random variables.

r=x+sigma.*randn(1,N);%AWGN channel output

m_cap=(r>0.5);

%BER calculation

num_e=sum(m~=m_cap)%total count of errors

ber_sim1=(num_e/N);

ber_sim=[ber_sim ber_sim1];

ber_theo1=0.5*erfc(sqrt(EbNO/4));

ber_theo=[ber_theo ber_theo1];

end

EbNOdB=0:1:15;

semilogy(EbNOdB,ber_sim, 'r*-',EbNOdB,ber_theo,'ko-')

xlabel('eb/NO(dB)');

ylabel('BER');

legend('simulation','Theory(erfc)');

grid on

%BIT ERROR RATE VERSUS SIGNAL TO NOISE POWER RATIO CURVE


FOR BPSK WITH AWGN CHANNEL
r=randi(1,10000);

for i=1:10000

if r(i)==0

s(i)=-1;

else

s(i)=1;

end

end

k=1;

for snrdb=1:1:10;

105
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

v=1/(10^(snrdb/10));

x=awgn(s,snrdb,'measured');

y=x;

for j=1:10000

if y(j)>0

z(j)=1;

else

z(j)=0;

end

end

error=length(find(z~=r));

ber(k)=error/10000;

k=k+1;

end

snrdb=1:1:10;

snrlin=10.^(snrdb./10);

tber=0.5.*erfc(sqrt(snrlin));

semilogy(snrdb,tber,'-mh')

grid on

title('BER Vs SNR for BPSK with AWGN channel');

xlabel('Signal to Noise Power Ratio');

ylabel('Bit Error Rate');

%BIT ERROR RATE VERSUS SIGNAL TO NOISE POWER RATIO CURVE


FOR FSK WITH AWGN CHANNEL
clear all;

close all;

clc;

106
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

num_bit=10000;

max_run=20;

Eb=1;

SNRdB=0:1:10;

SNR=10.^(SNRdB/10);

for count=1:length(SNR)

avgError=0;

No=Eb/SNR(count);

for run_time=1:max_run

Error=0;

data=randi(1,num_bit);

s=data+j*(~data);

NI=sqrt(No/2)*randn(1,num_bit);

NQ=sqrt(No/2)*randn(1,num_bit);

N=NI+j*NQ;

Y=s+N;

for k=1:num_bit

Z(k)=real(Y(k))-imag(Y(k));

if ((Z(k)>0 && data(k)==0)||(Z(k)<0 && data(k)==1))

Error=Error+1;

end

end

Error=Error/num_bit;

avgError=avgError+Error;

end

BER_sim(count)=avgError/max_run;

end

BER_th=(1/2)*erfc(sqrt(SNR/2));

107
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

semilogy(SNRdB,BER_th,'k');

hold on

semilogy(SNRdB,BER_sim,'k*');

legend('th','sim',4);

xlabel('SNR(dB)');

ylabel('BER');

title('BER Vs SNR for FSK with awgn channel');

axis([min(SNRdB) max(SNRdB) 10^(-5) 1]);

hold off

%BIT ERROR RATE VERSUS SIGNAL TO NOISE POWER RATIO


CURVE FOR QPSK WITH AWGN CHANNEL
clear all

close all

l=10000;

snrdb=1:1:10;

snr=10.^(snrdb/10);

for snrdb=1:1:10

si=2*(round(rand(1,l))-0.5);

sq=2*(round(rand(1,l))-0.5);

s=si+j*sq;

w=awgn(s,snrdb,'measured');

r=w;

si_=sign(real(r));

sq_=sign(imag(r));

ber1=(l-sum(si==si_))/l;

ber2=(l-sum(sq==sq_))/l;

ber(snrdb)=mean([ber1 ber2]);

end

108
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

snrdb=1:1:10;

snr=10.^(snrdb./10);

tber=0.5.*erfc(sqrt(snr));

semilogy(snrdb,tber,'-mh')

title('BER Vs SNR FOR QPSK with awgn channel');

xlabel('Signal to Noise Power Ratio');

ylabel('Bit Error Rate');

grid on;

%BIT ERROR RATE VERSUS SIGNAL TO NOISE POWER RATIO


CURVE FOR 16-QAM WITH AWGN CHANNEL
clear all;

close all;

format long;

bit_count=4*1000;

Eb_No=-6: 1: 10;

SNR =Eb_No+10*log10(4);

for aa=1:1:length(SNR)

T_Errors=0;

T_bits=0;

while T_Errors<100

uncoded_bits=round(rand(1,bit_count));

B=reshape(uncoded_bits,4,length(uncoded_bits)/4);

B1=B(1,:);

B2=B(2,:);

B3=B(3,:);

B4=B(4,:);

a=sqrt(1/10);

tx=a*(-2*(B3-0.5).*(3-2*B4)-j*2*(B1-0.5).*(3-2*B2));

109
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

NO=1/10^(SNR(aa)/10);

rx=tx+sqrt(NO/2)*(randn(1,length(tx))+i*randn(1,length(tx)));

a=1/sqrt(10);

B5=imag(rx)<0;

B6=(imag(rx)<2*a)&(imag(rx)>-2*a);

B7=real(rx)<0;

B8=(real(rx)<2*a)&(real(rx)>-2*a);

temp=[B5;B6;B7;B8];

B_hat=reshape(temp,1,4*length(temp));

diff=uncoded_bits-B_hat;

T_Errors=T_Errors+sum(abs(diff));

T_bits=T_bits+length(uncoded_bits);

end

BER(aa)=T_Errors/T_bits;

disp(sprintf('bit error probability= %f',BER(aa)));

figure;

grid on;

plot(rx,'x');

xlabel('Inphase Component');

ylabel('Quadrature Componenet');

Title('Constellation of Transmitted Symbols');

end

figure(1);

semilogy(SNR,BER,'or');

hold on;

grid on;

title('BER Vs SNR Curve for QAM-16 Modulation Scheme in AWGN');

xlabel('SNR (dB)');

110
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

ylabel('BER');

figure(1);

theoryBer=(1/4)*3/2*erfc(sqrt(4*0.1*(10.^(Eb_No/10))));

semilogy(SNR,theoryBer);

legend('Simulated','Theoretical');

% Bit Error Rate for 16-PSK modulation using Gray modulation mapping

clear

N = 10^5; % number of symbols

M = 16; % constellation size

k = log2(M); % bits per symbol

thetaMpsk = [0:M-1]*2*pi/M; % reference phase values

Eb_N0_dB = [0:25]; % multiple Es/N0 values

Es_N0_dB = Eb_N0_dB + 10*log10(k);

% Mapping for binary <--> Gray code conversion

ref = [0:M-1];

map = bitxor(ref,floor(ref/2));

[ttind] = sort(map);

ipPhaseHat = zeros(1,N);

for ii = 1:length(Eb_N0_dB)

% symbol generation

111
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

% ------------------

ipBit = rand(1,N*k,1)>0.5; % random 1's and 0's

bin2DecMatrix = ones(N,1)*(2.^[(k-1):-1:0]) ; % conversion from binary to decimal

ipBitReshape= reshape(ipBit,k,N).'; % grouping to N symbols having k bits each

ipGray = [sum(ipBitReshape.*bin2DecMatrix,2)].'; % decimal to binary

% Gray coded constellation mapping

ipDec = ind(ipGray+1)-1; % bit group to constellation point

ipPhase = ipDec*2*pi/M; % conversion to phase

ip = exp(j*ipPhase); % modulation

s = ip;

% noise

% -----

n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white guassian noise, 0dB variance

y = s + 10^(-Es_N0_dB(ii)/20)*n; % additive white gaussian noise

% demodulation

% ------------

% finding the phase from [-pi to +pi]

opPhase = angle(y);

% unwrapping the phase i.e. phase less than 0 are

% added 2pi

opPhase(find(opPhase<0)) = opPhase(find(opPhase<0)) + 2*pi;

% rounding the received phase to the closest constellation

ipPhaseHat = 2*pi/M*round(opPhase/(2*pi/M)) ;

112
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

% as there is phase ambiguity for phase = 0 and 2*pi,

% changing all phases reported as 2*pi to 0.

% this is to enable comparison with the transmitted phase

ipPhaseHat(find(ipPhaseHat==2*pi)) = 0;

ipDecHat = round(ipPhaseHat*M/(2*pi));

% Decimal to Gray code conversion

ipGrayHat = map(ipDecHat+1); % converting to decimal

ipBinHat = dec2bin(ipGrayHat,k) ; % decimal to binary

% converting binary string to number

ipBinHat = ipBinHat.';

ipBinHat = ipBinHat(1:end).';

ipBinHat = str2num(ipBinHat).' ;

% counting errors

nBitErr(ii) = size(find([ipBit- ipBinHat]),2); % couting the number of errors

end

simBer = nBitErr/(N*k);

theoryBer = (1/k)*erfc(sqrt(k*10.^(Eb_N0_dB/10))*sin(pi/M));

close all; figure

semilogy(Eb_N0_dB,theoryBer,'bs-','LineWidth',2);

hold on

semilogy(Eb_N0_dB,simBer,'mx-','LineWidth',2);

axis([0 20 10^-5 1])

grid on

113
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

legend('theory', 'simulation');

xlabel('Eb/No, dB')

ylabel('Bit Error Rate')

title('Bit error probability curve for 16-PSK modulation')

PROCEDURE:
Algorithm
Initialization commands

ASK, BPSK, FSK, QPSK, 16-PSK and 16-QAM modulation


1. Generate carrier signal.
2. Start FOR loop
3. Generate binary data, message signal in polar form
4. Generate modulated signal.
5. End FOR loop.

ASK, BPSK, FSK, QPSK, 16-PSK and 16-QAM demodulation


1. Start FOR loop
2. Perform correlation of modulated signal with carrier to get decision variable
Make decision to get demodulated binary data. If conditions satisfied then’
Plot the demodulated binary data.

ASK, BPSK, FSK, QPSK, 16-PSK and 16-QAM BER Vs SNR for modulated signal with
AWGN channel
1. find out bit error rate of modulated signal.
2. Given SNR values
3. Draw the curve for BER Vs SNR for modulated signal with AWGN channel.

EXPECTED WAVEFORMS:
ASK

114
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

BPSK

FSK

115
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

QPSK

16-PSK

116
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

16-QAM

PRECAUTIONS:-
1. Write the program with specific conditions.
2. Execute the program and find out the errors and solve it again execute until without errors.
3. Observe the curves for respective program.
4. Shutdown the system after execution of program.

RESULT:

117
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

EXPERIMENT-17
USING MATLAB PROGRAM, FIND THE HUFFMAN CODE FOR GIVEN
SET OF SAMPLES.
AIM: To write and simulate programs of the Huffman code for given set of samples in matlab
software.
APPARATUS REQUIRED:

Name of the Software Specifications/Range Quantity


MATLAB 2018a 01

THEORY:
There are many ways to store information. Computer scientist always looking for new
and better ways to store strings of data with as little space as possible. Huffman coding is a
method of storing strings of data as binary code in an efficient manner .Huffman coding uses"
lossless data compression" which means no information is lost which you are coded[3]

Huffman coding uses ' variable length [6] coding' which means that symbol in the

data you are encoded or converted to binary symbol based on how often that symbol is used
.for example if character 'a ' is used inyour data a lot , the binary symbol representing it is

shorter.If it is used rarely the symbol

representing it is longer .this way all the data will


be take less physical space when

encoded.There is a way to decide what


binary code to give each character using trees.

char Frequency
A 1
B 6
C 7
D 2
E 8

118
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

in this figure we have 5 different letter and also have frequency which often be use

a and d in this example is the least , frequency represent how often character appear in a
string of data now imagine these as 5 separate trees combine the two smallest tress in order

we can combine them slowly bit by bit first we combine a and d which are smallest after

combining them i have new tree with a greater frequency 3 now i will go for next least
number which is here b:6 now i have new tree with greater frequency 9. next i have two

more least character c and e and get the frequency 15 .finally i combine these two tress

and get one large tree .now we have large tree containing all the characters we can now
assign them a binary code to each symbol by going down the tree (each left branch receives

a '0' and each right branch willreceive '1' .if we go to the top we will get a binary string

a=000,b=01 , c=10 , d=001,e=11. These are what a ,b,c,d,e will each be converted to
Huffman coding is to encode data to take up less space wouldn't it make sense to give some

character binary code only 1 digit long ('0' or'1')or shouldn't more character be given code 2

digit long instead of 3?consider how you would read the code it is important for how each
representation to be unique from each other such that you can easily tell which character

that part is suppose to each represent .If '1' and '0' is representing a character any other

representation containing 1 and 0 could be different character . Now encode a,b,c,d,e using

Huffman code so we will take each character in replace it with the binary

abcbe=000 01 1001 11-00001100111

decode 1011001000011101

= c d e a 011101(only a start with 0 then 0 then 0)

=c d e a b1101(only b start with 0 then 1)

=c d e a b e 01(only e start with 1 then 1)

=c d e a b e b=cdeabeb

119
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

if we have to decode it you have to start either from back way front or front suppose we have

to accrue the average length via Huffman coding there is special formula for that so average
code word length=1/f(T)*sum of d(i)*f(i), for i=0 to i=n

where

n = number of character

f(T)=total frequency

f(i)=frequency of that character

d(i)= length of that symbol

if we consider it in our example[2]

Average length =(1/(1+6+7+2=8)*(3*1+2*6+2*7+3*2+2*8)

=(1/24)*(3+12+14+6+16)

=(1/24)*(51)

=2.125 digit long

(The average letter in the cod)[8]

Huffman Coding:
Pick two letters x,y from alphabet A with a smallest frequencies and create a subtree that
has these two characters as leaves label the root of this subtree as Z.Set frequency
f(z)=f(x)+f(y).Remove x,y and add z creating new alphabet
A’=AU{z}-{x,y}.
Note that /A’/=/A/-1.Repeat this procedure, called merge, with new alphabet A’ until an alphabet
with only one symbol is left. The resulting tree is the Huffman code.

PROGRAM:
clc;
clear all;
s=input('Enter symbols- ') %format ['a','b','c','d','e','f'];
p=input('Enter value of probabilty- ') %format [0.22,0.20,0.18,0.15,0.13,0.12];

120
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

if length(s)~=length(p)
error('Wrong entry.. enter again- ')
end

i=1;
for m=1:length(p)
for n=1:length(p)
if(p(m)>p(n))
a=p(n); a1=s(n);
p(n)=p(m);s(n)=s(m);
p(m)=a; s(m)=a1;
end
end
end
display(p) %arranged prob. in descending order.

tempfinal=[0];
sumarray=[];
w=length(p);
lengthp=[w];
b(i,:)=p;

while(length(p)>2)
tempsum=p(length(p))+p(length(p)-1);
sumarray=[sumarray,tempsum];
p=[p(1:length(p)-2),tempsum];
p=sort(p,'descend');
i=i+1;
b(i,:)=[p,zeros(1,w-length(p))];
w1=0;
lengthp=[lengthp,length(p)];

for temp=1:length(p)
if p(temp)==tempsum;
w1=temp;
end
end
tempfinal=[w1,tempfinal]; % Find the place where tempsum has been inserted
display(p);
end

sizeb(1:2)=size(b);
tempdisplay=0;
temp2=[];

121
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

fori= 1:sizeb(2)
temp2=[temp2,b(1,i)];
end
sumarray=[0,sumarray];
var=[];
e=1;
forifinal= 1:sizeb(2)
code=[s(ifinal),' ']
for j=1:sizeb(1)
tempdisplay=0;

for i1=1:sizeb(2)
if( b(j,i1)==temp2(e))
tempdisplay=b(j,i1);
end
if(tempdisplay==0 & b(j,i1)==sumarray(j))
tempdisplay=b(j,i1);
end
end
var=[var,tempdisplay];
iftempdisplay==b(j,lengthp(j)) %assign 0 & 1
code=[code,'1'];
elseiftempdisplay==b(j,lengthp(j)-1)
code=[code,'0'];
else
code=[code,''];
end
temp2(e)=tempdisplay;
end
display(code) %display final codeword
e=e+1;
end
PROCEDURE:
1. Open the MATLAB 2018a software app.
2. Initialization commands
3. Write the program with specific conditions.
4. Execute the program.
5. Find out the errors and solve it again execute until without errors
6. Observe the curves for respective program.

PRECAUTIONS:-

122
RGUKT Department of ECE
Analog and Digital Communication Laboratory Manual

1. Write the program with specific conditions and case sensitive.


2. Execute the program and find out the errors and solve it again execute until without errors.
3. Observe the curves for respective program with out eye errors
4. Shutdown the system after execution of program.

RESULT:

123
RGUKT Department of ECE

You might also like