Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
DIGITAL COMMUNICATION SYSTEMS
LABORATORY MANUAL
Subject Code :
Regulations :
Class : III B.Tech I-Sem(ECE)
CHADALAWADA RAMANAMMA ENGINEERING COLLEGE (AUTONOMOUS)
Chadalawada Nagar, Renigunta Road, Tirupati – 517 506
Department of Electronics and Communication Engineering
17CA04510
R17
CHADALAWADA RAMANAMMA ENGINEERING COLLEGE (AUTONOMOUS)
Chadalawada Nagar, Renigunta Road, Tirupati – 517 506
Department of Electronics and Communication Engineering
INDEX
S. No Name of the Experiment Page No
1 Time division multiplexing. 1-4
2 Pulse code modulation. 5-8
3 Differential pulse code modulation. 9-10
4 Delta modulation. 11-13
5 Frequency shift keying. 14-17
6 Differential phase shift keying. 18-21
Experiments using MATLAB
7 Verification of Sampling Theorem 23-25
8 Pulse code modulation. 26-28
9 Differential pulse code modulation. 29-30
10 Frequency shift keying. 31-32
11 PSK Modulation and Demodulation 33-35
12 Differential phase shift keying. 36-39
Experiments Beyond the syllabus Using MATLAB
13 Quadrature Phase Shift Keying. 40-42
14 Delta modulation. 43-44
15 ASK Modulation and Demodulation 45-47
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 1
Expt-no:1
TIME DIVISION MULTIPLEXING AND DEMULTIPLEXING
Aim:
1. To study the 4 channel analog multiplexing and demultiplexing
2. To study the effect of sampling frequency on output signal characteristics.
3.To study the effect of input signal amplitude on the output signal characteristics .
Apparatus required:
1. Time Division Multiplexing and de multiplexing trainer Kit.
2. Dual Trace oscilloscope
Theory:
In PAM, PPM the pulse is present for a short duration and for most of the time
between the two pulses no signal is present. This free space between the pulses can
be occupied by pulses from other channels. This is known as Time Division
Multiplexing. Thus, time division multiplexing makes maximum utilization of the
transmission channel. Each channel to be transmitted is passed through the low
pass filter. The outputs of the low pass filters are connected to the rotating
sampling switch (or) commutator. It takes the sample from each channel per
revolution and rotates at the rate of f s . Thus the sampling frequency becomes fs
the single signal composed due to multiplexing of input channels. These channels
signals are then passed through low pass reconstruction filters. If the highest signal
frequency present in all the channels is f m , then by sampling theorem, the
sampling frequency f s must be such that f s ≥2f m . Therefore, the time space
between successive samples from any one input will be T s =1/f s, and T s ≤ 1/2fm.
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 2
Fig: Time Division Multiplexing And Demultiplexing Circuit
Procedure:
There are 4 signal sources;
a) AF Signal generator
b) Triangular wave generator
c) Square wave generator and
d) Sine wave generator
1. Connect these four signals to four inputs of the Multiplexer. Adjust each
signal amplitude to be with in +/-2V (p-p) and frequency non-over lapping
within a frequency band of 300Hz.
2. Connect A, B output of 7476 to AI, BI inputs of Multiplexer.
3. Adjust the frequency of IC 8038 (Square wave, triangular wave
generator) to be around 32 KHz, so that each of the Four channels are
sampled at 8 KHz.
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 3
4. Adjust the pulse width of 555 timers to be around 10μsecs.
5. Observe the 4 output pin 11 of 7476 on one channel 1and TDM output pin 13
of CD4052 on second channel of oscilloscope. Synchronize scope Internal-CH
1 mode. All the multiplexed channels are observed during the full period of the
clock (1/32 KHz).
6. Connect TDM output to comparator –ve input and saw tooth wave to +ve
Input. Observe the Comparator output. The PAM pulses are now converted in
to PWM pulses.
7. Connect the PWM pulses to TDM input of De multiplexer at pin 3 of second
CD4052. Observe the individual outputs Y0, Y1, Y2, and Y3 at pin 1, 5, 2 & 4
of CD4052 respectively. The PWM pulses corresponding to each channels
are now separated as 4 streams.
8. Take one output and connect it to Low Pass Filter and the Low Pass Filter
output to Amplifier. Observe the output of the amplifier in conjunction with the
corresponding input. Repeat this for all 4 inputs. This is the Demodulated
TDM output. Any slight variation in frequency, amplitude is reflected in the
corresponding output.
Observations:
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 4
Model Waveform:
Multiplexed output
RESULT:
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 5
Expt-no:2
PULSE CODE MODULATION & DEMODULATION
AIM:
To generate a PCM signal using PCM modulator and detect the message signal
using PCM demodulator.
APPARATUS REQUIRED:
1. PCM kit
2. CRO
3. Connecting probes
THEORY:
Pulse code modulation is a process of converting an analog signal into digital. The
voice or any data input is first sampled using a sampler (which is a simple switch)
and then quantized. Quantization is the process of converting a given signal
amplitude to an equivalent binary number with fixed number of bits. This
quantization can be either midtread or mid-raise and it can be uniform or non-
uniform based on the requirements. For example in speech signals, the higher
amplitudes will be less frequent than the low amplitudes. So higher amplitudes are
given less step size than the lower amplitudes and thus quantization is performed
non-uniformly. After quantization the signal is digital and the bits are passed
through a parallel to serial converter and then launched into the channel serially.
At the demodulator the received bits are first converted into parallel frames and
each frame is de-quantized to an equivalent analog value. This analog value is thus
equivalent to a sampler output. This is the demodulated signal.
In the kit this is implemented differently. The analog signal is passed through a
ADC (Analog to Digital Converter) and then the digital codeword is passed
through a parallel to serial converter block. This is modulated PCM. This is taken
by the Serial to Parallel converter and then through a DAC to get the demodulated
signal. The clock is given to all these blocks for synchronization. The input signal
can be either DC or AC according to the kit. The waveforms can be observed on a
CRO for DC without problem.AC also can be observed but with poor resolution.
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 6
PROCEDURE:
1. Make the connections as per the diagram as shown in the Fig.1.and switch on
the power supply of the trainer kit.
2. Clock generator generates a 20 KHz clock .This can be given as input to the
timing and control circuit and observe the sampling frequency fs= 2 KHz
approximately at the output of timing and control circuit.
3. Apply the signal generator output of 6V(p-p) approximately to the A to D
converter input and note down the binary word from LED’s i.e. LED “ON”
represents ‘1’ & “OFF” represents ‘0’
4. Feed the PCM waveform to the demodulator circuit and observe the waveform
at the output of D/A which is quantized level.
Circuit Diagram:
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 7
Wave forms:
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 8
Calculations:
Result:
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 9
Expt No:3
DIFFERENTIAL PULSE CODE MODULATION
AIM: To Study & understand the operation of the DPCM
EQUIPMENT REQUIRED:
1. DPCM Modulator & Demodulator trainer
2. Storage Oscilloscope
3. Digital Multimeter
4. 2 No’s of co- axial cables (standard accessories with trainer)
5. Patch chords
THEORY:
In this DPCM instead of transmitting a base band signal m(t) we send the
difference signal of Kth sample and (k-1) th sample value. The advantage here is
fewer levels are required to quantize the difference than the required to quantize
m(t) and correspondingly, fewer bits will be needed to encode the levels. If we
know the post behaviour of a signal up to a certain time, it is possible to make
some interference about its future values this is called prediction. The filter
designed to perform the prediction is called a predictor. The difference between the
interest and the predictor o/p is called the prediction error.
Circuit Diagram:
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 10
Procedure:
1. Switch on the experimental kit.
2. Apply the variable DC signal of amplitude 6v(p-p) with frequency of 80Hz
to the input terminals of DPCM modulator.
3. Observe the sampling signal of amplitude 5v (p-p) with frequency 20KHz
on channel 1 of a CRO.
4. Observe the output of DPCM on the second channel.
5. By adjusting the DC voltage potentiometer, observe the DPCM output.
6. During the demodulation connect DPCM output to the input of
demodulator and observe the output of DPCM demodulator.
Waveform:
Result:
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 11
Expt-No:4
DELTA MODULATION & DEMODULATION
AIM: To study the characteristics of Delta Modulation and Demodulation.
EQUIPMENT REQUIRED:
1. DM Modulator & Demodulator trainer
2. Storage Oscilloscope
3. Digital multimeter.
4. 2 No’s co-axial cables (standard accessories with trainer)
THEORY:
Delta modulation is almost similar to differential PCM. In this, only one bit is
transmitted per sample just to indicate whether the present sample is larger or
smaller than the previous one. The encoding, decoding and quantizing process
become extremely simple but this system cannot handle rapidly varying samples.
This increases quantizing noise. It has also not found wide acceptance.
Circuit Diagram:
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 12
Procedure:
1. Switch on the experimental board.
2. Connect the clock signal of frequency of 10KHz,with amplitude of 5v(p-p)
to the delta modulator circuit.
3. Connect the modulating signal of amplitude 5v(p-p) and frequency of of
0.2KHz modulating input of the delta modulator
And observe the same on channel 1 of a Dual Trace oscilloscope.
4. Observe the Delta Modulator output on channel 2.
5. Connect this Delta modulator output to the Demodulator
6. Also connect the clock signal to the demodulator.
7. Observe the Demodulator output with and without RC filter on CRO.
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 13
Model Waveforms:
Result:
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 14
Expt-No:5
FREQUENCY SHIFT KEYING
AIM: To study the characteristics of Frequency Shift keying
EQUIPMENT REQUIRED:
1. Frequency Shift Keying system trainer
2. Dual trace Oscilloscope
3. Digital multimeter
4. Digital frequency counter
THEORY:
Frequency Shift Keying (FSK) is a modulation/ Data transmitting technique in
which carrier frequency is shifted between two distinct fixed frequencies to
represent logic 1 and logic 0. The low carrier frequency represents a digital 0
(space) and higher carrier frequency is a 1 (mark). FSK system has a wide range of
applications in low speed digital data transmission systems. Wave forms are
shown in Figure. FSK Modulating & Demodulating circuitry can be developed in
number of ways, familiar VCO and PLL circuits are used in this trainer.
Procedure:
1. Connect the circuit as shown in fig.1
2. Apply the (binary) Data input of amplitude 20V (p-p) with frequency of 6 KHz
from function generator to pin no.7.
3. Give the power supply of 10v to the appropriate pins.
4. Observe the FSK output at pin no.2.
5. Now note down the mark and space frequencies for different carrier
frequencies.
6. Calculate the maximum frequency deviation and modulation index.
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 15
7. Repeat the steps (5) and (6) for different pulse durations of binary input.
Circuit Diagram:
Fig: Block diagram for Frequency Shift Keying
Procedure:
1 Connect the AC Adaptor to the mains and the other side to the
Experimental Trainer. Switch‘ON’ the power.
2 Connect ‘Data Input’s socket to ground
3 Connect the FSK output to the Ch1 of the Oscilloscope and trigger the
scope from Ch1.
4 Set the ‘ Freq. Adj ’ Potentiometer So that the output is around 30 kHz
approx.
5 Set the Switches for required word pattern. Push the load switch
momentarily and release . This will parallel load the word pattern and then
shifts the pattern that is set Adjust the required frequency of the clock.
6 Connect the Data input to ‘ Ground’, Measure the frequency.
7 Connect the ‘ Data output ‘ to ‘ Data input ‘ .
8 Observe the Data output on CH1 and FSK output on CH2.
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 16
9 Observe that at each negative transition’ ‘ the carrier switches from high to low
and every positive transition ‘ ‘ the frequency switches from low to high.
10 Connect ’FSK output ‘ to ‘ FSK input ’ of the Demodulator.
11 Adjust P3 to regenerate the Data correctly.
12 Compare the Demod output to the Data output which are identical in nature.
13 Change the Data Pattern as mentioned in sl No 6, and Observe the Demod
output again.
Model Waveform:
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 17
Tabulations:
Result:
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 18
Expt-No:6
Differential phase shift keying
AIM: To study the characteristics of differential phase shift keying.
EQUIPMENT REQUIRED:
1. Differential Phase Shift Keying Kits
2. C.R.O
3. Digital multimeter.
4. No’s of coaxial cables (standard accessories with trainer)
THEORY:
DPSK: Phase Shift Keying requires a local oscillator at the receiver which is
accurately synchronized in phase with the un-modulated transmitted carrier, and in
practice this can be difficult to achieve. Differential Phase Shift Keying (DPSK)
over comes the difficult by combining two basic operations at the transmitter (1)
differential encoding of the input binary wave and (2) phase shift keying – hence
the name differential phase shift keying. In other words DPSK is a non - coherent
version of the PSK. DPSK DEMODULATOR: Fig shows the DPSK modulator.
This consists of PSK modulator and differential encoder. PSK Modulator: IC CD
4052 is a 4 channel analog multiplexer and is used as an active component in this
circuit. One of thecontrol signals of 4052 is grounded so that 4052 will act as a
two channel multiplexer and other control is being connected to the binary signal
i.e., encoded data. Un shifted carrier signal is connected directly to CH1 and carrier
shifted by 1800 is connected to CH2. Phase shift network is a unity gain inverting
amplifier using Op-Amp (TL084).
When control signal is at high voltage, output of the 4052 is connected to CH1
and un-shifted (or 0 phase) carrier is passed on to output. Similarly when control
signal is at zero voltage output of 4052 is connected to CH2 and carrier shifted by
1800 is passed on to output.
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 19
Differential encoder: This consists of 1 bit delay circuit and an X-NOR Gate. 1 bit
delay circuit is formed by a D-Latch. Data signal i.e., signal to be transmitted is
connected to one of the input of the X-NOR gate and other one being connected to
out of the delay circuit. Output of the X-NOR gate and is connected to control
input of the multiplexer (IC 4052) and as well as to input of the D-Latch. Output
of the X-NOR gate is 1 when both the inputs are same and it is 0 when both the
inputs are different.
Circuit Diagram:
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 20
Procedure:
1. Switch on the experimental board.
2. Check the carrier signal and the data generator signals initially.
3. Apply the carrier signal of amplitude 6v (p-p) with frequency of1KHz to the
carrier input, the data input of amplitude 5v (p-p) with frequency of 600Hz
to the data input and bit clock of amplitude 5v (p-p) with and frequency of
1 KHz to the DPSK modulator.
4. Observe the DPSK wave of amplitude 5.6v (p-p) and frequency of 1 KHz
with respect to the input data generated signal of dual trace oscilloscope.
5. Give the output of the DPSK modulator signal to the input of demodulator,
give the bit clock output to the bit clock input to the demodulator and also
give the carrier output to the carrier input of demodulator.
6. Observe the demodulator output with respect to data generator signal.
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 21
Waveform:
Result:
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 22
Software Programs using MATLAB
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 23
Verification of Sampling Theorem
AIM :
To write a MATLAB program for the process of sampling and to reconstruct the signals and
observe the output waveforms.
Requirements: PC and MATLAB software
THEORY:
A message signal may originate from a digital or analog source. If the message signal is analog
in nature, then it has to be converted into digital form before it can transmitted by digital means.
The process by which the continuous-time signal is converted into a discrete time signal is called
Sampling. Sampling operation is performed in accordance with the sampling theorem.
Sampling Theorem For Low-Pass Signals:-
Statement:- “If a band –limited signal g(t) contains no frequency components for ׀f |f| > W,
then it is completely described by instantaneous values g(kTs) uniformly spaced in time
with period Ts ≤ 1/2W. If the sampling rate, fs is equal to the Nyquist rate or greater (fs ≥
2W), the signal g(t) can be exactly reconstructed”.
Program:
clear all;
close all;
clc;
t=-10:.01:10; %t vector
T=8; %time period
fm=1/T; %frequency
x=cos(2*pi*fm*t); %cos wave
fs1=1.6*fm; %fs<2fm
fs2=2*fm; %fs=2fm
fs3=8*fm; %fs>2fm
n1=-4:1:4; %index vector
xn1=cos(2*pi*n1*fm/fs1);%aliasing
EXPT. NO-7
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 24
subplot(2,2,1);
plot(t,x);
xlabel('time in sec');
ylabel('x(t)');
title('continuous time signal');
subplot(2,2,2);
stem(n1,xn1); %aliasing discrete
hold on;
plot(n1,xn1); %aliasing cont
xlabel('n');
ylabel('x(n)');
title('discrete time s/g with fs<2fm');
n2=-5:1:5; %time index
xn2=cos(2*pi*n2*fm/fs2); %fs=2fm
subplot(2,2,3);
stem(n2,xn2); %sampling for fs=2fm
hold on;
plot(n2,xn2); %ploting fs=2fm
xlabel('n');
ylabel('x(n)');
title('discrete time s/g with fs=2fm');
n3=-20:1:20; %time index
xn3=cos(2*pi*n3*fm/fs3); %fs>2fm
subplot(2,2,4);
stem(n3,xn3); %samples for fs>2fm
hold on;
plot(n3,xn3); %ploting fs>2fm
xlabel('n');
ylabel('x(n)');
title('discrete time s/g with fs>2fm');
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati Page 25
Waveforms:
Result:
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
Pulse Code Modulation
AIM:To write a MATLAB program for Pulse Code Modulation and to observe the output wave
forms.
Requirements:PC and MATLAB software
Description: Pulse code modulation (PCM) is a digital scheme for transmitting analog data.
The signals in PCM are binary; that is, there are only two possible states, represented by
logic 1 (high) and logic 0 (low). This is true no matter how complex the analog waveform
happens to be. Using PCM, it is possible to digitize all forms of analog data, including
full-motion video, voices, music, telemetry, and virtual reality (VR).
To obtain PCM from an analog waveform at the source (transmitter end) of a
communications circuit, the analog signal amplitude is sampled (measured) at regular time
intervals.The sampling rate, or number of samples per second, is several times the
maximum frequency of the analog waveform in cycles per second or hertz. The
instantaneous amplitude of the analog signal at each sampling is rounded off to the nearest
of several specific, predetermined levels. This process is called quantization. The number
of levels is always a power of 2 -- for example, 8, 16, 32, or 64. These numbers can be
represented by three, four, five, or six binary digits (bits) respectively. The output of a
pulse code modulator is thus a series of binary numbers, each represented by some power
of 2 bits.
At the destination (receiver end) of the communications circuit, a pulse code demodulator
converts the binary numbers back into pulses having the same quantum levels as those in
the modulator. These pulses are further processed to restore the original analog waveform.
Program:
clc;
close all;
clear all;
n=input('Enter n value for n-bit PCM system : ');
n1=input('Enter number of samples in a period : ');
L=2^n;
x=0:2*pi/n1:4*pi; % n1 nuber of samples have tobe selected
s=8*sin(x);
subplot(3,1,1);
plot(s);
title('Analog Signal');
ylabel('Amplitude--->');
xlabel('Time--->');
Page 26
EXPT. NO-8
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
subplot(3,1,2);
stem(s);grid on; title('Sampled Signal'); ylabel('Amplitude--->'); xlabel('Time--->');
% Quantization Process
vmax=8;
vmin=-vmax;
del=(vmax-vmin)/L;
part=vmin:del:vmax;
code=vmin-(del/2):del:vmax+(del/2);
[ind,q]=quantiz(s,part,code);
l1=length(ind);
l2=length(q);
for i=1:l1
if(ind(i)~=0) ind(i)=ind(i)-1;
end
i=i+1;
end
for i=1:l2
if(q(i)==vmin-(del/2)) % q(i)=vmin+(del/2);
end
end
subplot(3,1,3);
stem(q);grid on;
title('Quantized Signal');
ylabel('Amplitude--->');
xlabel('Time--->');
% Encoding Process
figure
code=de2bi(ind,'left-msb');
k=1;
for i=1:l1
for j=1:n
coded(k)=code(i,j);
j=j+1;
k=k+1;
end
i=i+1;
end
subplot(2,1,1); grid on;
stairs(coded);
axis([0 100 -2 3]); title('Encoded Signal');
ylabel('Amplitude--->');
xlabel('Time--->');
% Demodulation Of PCM signal
qunt=reshape(coded,n,length(coded)/n);
index=bi2de(qunt','left-msb');
Page 27
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
q=del*index+vmin+(del/2);
subplot(2,1,2); grid on;
plot(q);
title('Demodulated Signal');
ylabel('Amplitude--->');
xlabel('Time--->');
Output:
Enter n value for n-bit PCM system : 8
Enter number of samples in a period : 8
Result:
0 10 20 30 40 50 60 70 80 90 100-2
-1
0
1
2
3Encoded Signal
Ampli
tude--
->
Time--->
0 2 4 6 8 10 12 14 16 18-10
-5
0
5
10Demodulated Signal
Ampli
tude--
->
Time--->
0 2 4 6 8 10 12 14 16 18-10
0
10Analog Signal
Am
plitu
de--
->
Time--->
0 2 4 6 8 10 12 14 16 18-10
0
10Sampled Signal
Am
plitu
de--
->
Time--->
0 2 4 6 8 10 12 14 16 18-10
0
10Quantized Signal
Am
plitu
de--
->
Time--->
Page 28
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
Expt no:
Differential Pulse Code Modulation
Aim: To write a MATLAB program for Differential Pulse Code Modulation
and to observe the output wave forms.
Apparatus:
Operating Systems: Windows
Software Tools: Matlab
Theory:
In this DPCM instead of transmitting a base band signal m(t) we send the
difference signal of Kth sample and (k-1) th sample value. The advantage
here is fewer levels are required to quantize the difference than the
required to quantize m(t) and correspondingly, fewer bits will be needed
to encode the levels. If we know the post behaviour of a signal up to a
certain time, it is possible to make some interference about its future
values this is called prediction. The filter designed to perform the
prediction is called a predictor. The difference between the interest and
the predictor o/p is called the prediction error.
Program:
Clc; Clear all; Close all; predictor = [0 1]; % y(k)=x(k-1) partition = [-1:.1:.9];
codebook = [-1:.1:1];
t = [0:pi/50:2*pi];
x = sawtooth(3*t); % Original signal
% Quantize x using DPCM.
9
Page 29
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
encodedx = dpcmenco(x,codebook,partition,predictor);
% Try to recover x from the modulated signal.
decodedx = dpcmdeco(encodedx,codebook,predictor);
plot(t,x,t,decodedx,'--')
legend('Original signal','Decoded signal','Location','NorthOutside');
distor = sum((x-decodedx).^2)/length(x) % Mean square error
Output:
The output is
distor = 0.0327
Result:
Page 30
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
FREQUENCY SHIFT KEYING
AIM:To write a MATLAB program for Frequency Shift Keying and to observe the output wave
forms.
Requirements:PC and MATLAB software
Description:
Frequency-shift keying (FSK) allows digital information to be transmitted by changes or
shifts in the frequency of a carrier signal, most commonly an analog carrier sine wave. There are
two binary states in a signal, zero (0) and one (1), each of which is represented by an analog
wave form. This binary data is converted by a modem into an FSK signal, which can be
transmitted via telephone lines, fiber optics or wireless media. FSK is commonly used for caller
ID and remote metering applications. FSK is also known as frequency modulation (FM).
Program:
clc;
close all;
clear all;
fc1=input('Enter the freq of 1st Sine Wave carrier:');
fc2=input('Enter the freq of 2nd Sine Wave carrier:');
fp=input('Enter the freq of Periodic Binary pulse (Message):');
amp=input('Enter the amplitude (For Both Carrier & Binary Pulse Message):');
amp=amp/2;
t=0:0.001:1;
c1=amp.*sin(2*pi*fc1*t);% For Generating 1st Carrier Sine wave
c2=amp.*sin(2*pi*fc2*t);% For Generating 2nd Carrier Sine wave
subplot(4,1,1); %For Plotting The Carrier wave
plot(t,c1)
xlabel('Time')
ylabel('Amplitude')
title('Carrier 1 Wave')
subplot(4,1,2) %For Plotting The Carrier wave
plot(t,c2)
xlabel('Time')
ylabel('Amplitude')
title('Carrier 2 Wave')
m=amp.*square(2*pi*fp*t)+amp;%For Generating Square wave message
subplot(4,1,3) %For Plotting The Square Binary Pulse (Message)
Page 31
EXPT. NO-10
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
plot(t,m)
xlabel('Time')
ylabel('Amplitude')
title('Binary Message Pulses')
for i=0:1000 %here we are generating the modulated wave
if m(i+1)==0
mm(i+1)=c2(i+1);
else
mm(i+1)=c1(i+1);
end
end
subplot(4,1,4) %For Plotting The Modulated wave
plot(t,mm)
xlabel('Time')
ylabel('Amplitude')
title('Modulated Wave')
The following INPUTS GIVEN TO GENERATE FSK MODULATED WAVE:
Enter the freq of 1st Sine Wave carrier:10
Enter the freq of 2nd Sine Wave carrier:30
Enter the freq of Periodic Binary pulse (Message):5
Enter the amplitude (For Both Carrier & Binary Pulse Message):4
Wave Forms:
Result:
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-2
02
Time
Am
plitu
de Carrier 1 Wave
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-2
02
Time
Am
plitu
de Carrier 2 Wave
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
24
Time
Am
plitu
de Binary Message Pulses
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-2
02
Time
Am
plitu
de Modulated Wave
Page 32
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
PSK Modulation & Demodulation
AIM:
To perform the simulation of PSK modulation and demodulation using MATLAB.
EQUIPMENTS REQUIRED:
1. Operating system:Windows XP
2. Software:MATLAB
THEORY:
The simplest PSK technique is called binary phase-shift keying (BPSK). It uses two opposite
signal phases (0 and 180 degrees). The digital signal is broken up timewise into individual bits
(binary digits). The state of each bit is determined according to the state of the preceding bit. If
the phase of the wave does not change, then the signal state stays the same (0 or 1). If the phase
of the wave changes by 180 degrees -- that is, if the phase reverses -- then the signal state
changes (from 0 to 1, or from 1 to 0). Because there are two possible wave phases, BPSK is
sometimes called biphase modulation.
MATLAB is a programming language developed by MathWorks. It started out as a matrix
programming language where linear algebra programming was simple. It can be run both under
interactive sessions and as a batch job. Alternatives to MATLAB exist including open source
software packages.
MATLAB is interesting in that it is dynamically compiled. In other words, when you're using it,
you won't run all your code through a compiler, generate an executable, and then run the
executable file to obtain a result. Instead, MATLAB simply goes line by line and performs the
calculations without the need for an executable. Partly because of this, it is possible to do
calculations one line at a time at the command line using the same syntax as would be used in a
file. It's even possible to write loops and branches at the command line if you want to. Of course
this would often lead to a lot of wasted efforts, so doing anything beyond very simple
calculations, testing to see if a certain function, syntax, etc. works, or calling a function you put
into an .m file should be done within an .m file.
PROGRAM:
clc;
clearall;
closeall;
n=100;
Page 33
EXPT. NO-11
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
x=[ones(1,20) zeros(1,20) ones(1,20) zeros(1,20) ones(1,20)];
subplot(4,1,1);
plot(x);
title('input signal');
xlabel('number of samples');
ylabel('amplitude');
f=1*10^6;
fs=10*10^6;
for i=0:n-1
d(i+1)=sin(2*pi*(f/fs)*i);
end
subplot(4,1,2);
plot(d);
title('carrier signal');
xlabel('number of samples');
ylabel('amplitude');
for i=0:n-1
if(x(i+1)==0)
x(i+1)=sin(2*pi*(f/fs)*i);
else
x(i+1)=sin(2*pi*(f/fs)*i+pi);
end
end
subplot(4,1,3);
plot(x);
title('PSK Signal');
xlabel('number of samples');
ylabel('amplitude');
Page 34
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
for i=0:n-1
if(x(i+1)==sin(2*pi*(f/fs)*i))
x(i+1)=0;
else
x(i+1)=1;
end
end
subplot(4,1,4);
plot(x);
title('PSK Signal');
xlabel('number of samples');
ylabel('amplitude');
OUTPUT:
RESULT:
Page 35
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
Differential Phase Shift Keying
Aim: To write a MATLAB program for Differential Phase Shift Keying and to observe the output
wave forms.
Apparatus:
Operating System: Windows
Software Tools: Matlab
Theory:
Differential phase shift keying (DPSK), a common form of phase modulation conveys data by
changing the phase of carrier wave. In DPSK, there is no absolute carrier phase reference, instead
transmitted signal itself used as phase reference. For example, in differentially encoded BPSK a
binary '1' may be transmitted by adding 180° to the current phase and a binary '0' by adding 0° to
the current phase. For a signal that has been differentially encoded, there is an obvious alternative
method of demodulation. Instead of demodulating as usual and ignoring carrier-phase ambiguity,
the phase between two successive received symbols is compared and used to determine what the
data must have been. When differential encoding is used in this manner, the scheme is known as
differential phase-shift keying (DPSK).
PROGRAM
DPSK transmitter
nS=1000;
nSym=2000; %Number of samples
M=2;
Tb=1e-6; %Bit rate
fc=1e6; %Carrier frequency
s=randi([0 M-1],nSym,1); %Information signal
s_mod=pskmod(s,M,pi); %NRZ Polar encoder
s_mod=rectpulse(s_mod,nS);
h1=scatterplot(s_mod);
t=0:(Tb/nS):nSym*Tb-(Tb/nS); %Time domain
t=transpose(t);
figure(2);plot(t,s_mod)
axis([0 (10*Tb-(Tb/(nS))) -1.2 1.2]); %plot only first 10 bits
title('Input bit stream after NRZ Encoder');
xlabel('Time(seconds)');
Expt No:12
Page 36
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
ylabel('amplitude');
s_tx_nn=s_mod.*cos(2*pi*fc*t)
Channel with AWGN Noise
%Additive Channel Noise
att=1;
SNR=1;
s_tx_noise=awgn(s_tx_nn,SNR,'measured');
h2=scatterplot(s_tx_noise,nS,nS/2);
%Additive Channel attenuation(10dB)
s_tx_noise_att=s_tx_noise/att;
DPSK Receiver
s_tx=s_tx_noise_att;
s_rx=s_tx.*cos(2*pi*fc*t);
figure;plot(t,s_rx);
axis([0 (10*Tb-(Tb/(nS))) -2/att 2/att]);
title('Recieved Signal Before Integration')
xlabel('Time(Seconds)') ylabel('Amplitude')
figure;stem(0:nS*nSym-1, s_mod(1 :nS*nSym))
plot(t,s_tx_noise_att,'g')
hold on
plot(t,s_tx_nn/att,'LineWidth',1); %DPSK madulated signal+Noise axis([0
(10*Tb-(Tb/(nS))) -2/att 2/att]);
title('Tx vs. Rx (Normalized)')
xlabel('Time (Seconds) ')
ylabel('Amplitude')
h3=scatterplot(s_rx,nS,nS/2);%Scatter Plot in presence of Noise
y=intdump(s_rx,nS);
y_mod=rectpulse(y,nS);
h4=scatterplot(y_mod, nS, nS/2);%Scatter Plot when Noise is removed
r_mod=pskdemod(y_mod,M,pi);%DPSK Demodulation
figure; plot(t,r_mod)
axis([0 (10*Tb-(Tb/(nS))) -0.2 1.2]);
title('Demodulated output')
xlabel('Time (seconds) ')
ylabel('Amplitude')
Page 37
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
Page 38
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
Result:
Page 39
Type your text
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
QPSK Modulation and Demodulation
AIM: To write a MATLAB program for QPSK Modulation and Demodulation and to observe
the output wave forms.
Requirements: PC and MATLAB software
Description:Quadrature phase shift keying (QPSK) modulators are used to change the
amplitude, frequency, and/or phase of a carrier signal in order to transmit information.
QPSK devices modulate input signals by 0°, 90°, 180°, and 270° phase shifts. QPSK
modulators modulators are used in conjunction with demodulators that extract information
from the modulated, transmitted signal. Some QPSK modulators include an integral
dielectric resonator oscillator. Others are suitable for military or wireless applications.
QPSK modulators with root raised cosine (RRC) and Butterworth filters are also
available.
Program:
clc;
clear all;
close all;
%GENERATE QUADRATURE CARRIER SIGNAL
Tb=1;t=0:(Tb/100):Tb;fc=1;
c1=sqrt(2/Tb)*cos(2*pi*fc*t);
c2=sqrt(2/Tb)*sin(2*pi*fc*t);
%generate message signal
N=8;m=rand(1,N);
t1=0;t2=Tb
for i=1:2:(N-1)
t=[t1:(Tb/100):t2]
if m(i)>0.5
m(i)=1;
m_s=ones(1,length(t));
else
m(i)=0;
m_s=-1*ones(1,length(t));
end
%odd bits modulated signal
odd_sig(i,:)=c1.*m_s;
if m(i+1)>0.5
m(i+1)=1;
m_s=ones(1,length(t));
else
m(i+1)=0;
m_s=-1*ones(1,length(t));
Page 40
EXPT. NO-13
Type your text
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
end
%even bits modulated signal
even_sig(i,:)=c2.*m_s;
%qpsk signal
qpsk=odd_sig+even_sig;
%Plot the QPSK modulated signal
subplot(3,2,4);plot(t,qpsk(i,:));
title('QPSK signal');xlabel('t---->');ylabel('s(t)');grid on; hold on;
t1=t1+(Tb+.01); t2=t2+(Tb+.01);
end
hold off
%Plot the binary data bits and carrier signal
subplot(3,2,1);stem(m);
title('binary data bits');xlabel('n---->');ylabel('b(n)');grid on;
subplot(3,2,2);plot(t,c1);
title('carrier signal-1');xlabel('t---->');ylabel('c1(t)');grid on;
subplot(3,2,3);plot(t,c2);
title('carrier signal-2');xlabel('t---->');ylabel('c2(t)');grid on;
% QPSK Demodulation
t1=0;t2=Tb
for i=1:N-1
t=[t1:(Tb/100):t2]
%correlator
x1=sum(c1.*qpsk(i,:));
x2=sum(c2.*qpsk(i,:));
%decision device
if (x1>0&&x2>0)
demod(i)=1;
demod(i+1)=1;
elseif (x1>0&&x2<0)
demod(i)=1;
demod(i+1)=0;
elseif (x1<0&&x2<0)
demod(i)=0;
demod(i+1)=0;
elseif (x1<0&&x2>0)
demod(i)=0;
demod(i+1)=1;
end
t1=t1+(Tb+.01); t2=t2+(Tb+.01);
end
subplot(3,2,5);stem(demod);
title('qpsk demodulated bits');
xlabel('n---->');ylabel('b(n)');grid on;
Page 41
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
wave forms:
Result:
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5-2
-1
0
1
2QPSK signal
t---->
s(t
)
1 2 3 4 5 6 7 80
0.2
0.4
0.6
0.8
1binary data bits
n---->
b(n
)
3 3.2 3.4 3.6 3.8 4 4.2 4.4-1.5
-1
-0.5
0
0.5
1
1.5carrier signal-1
t---->
c1(t
)
3 3.2 3.4 3.6 3.8 4 4.2 4.4-1.5
-1
-0.5
0
0.5
1
1.5carrier signal-2
t---->
c2(t
)
1 2 3 4 5 6 7 80
0.2
0.4
0.6
0.8
1qpsk demodulated bits
n---->
b(n
)
Page 42
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
Delta modulation
AIM:To write a MATLAB program for Delta Modulation and to observe the output wave
forms.
Requirements:PC and MATLAB software
Description: A Delta modulation (DM or Δ-modulation) is an analog-to-digital and digital-to-analog
signal conversion technique used for transmission of voice information where quality is not of
primary importance. DM is the simplest form of differential pulse-code modulation (DPCM)
where the difference between successive samples is encoded into n-bit data streams. In delta
modulation, the transmitted data are reduced to a 1-bit data stream.
Program:
clc;
clear all;
close all;
a=2;
t=0:2*pi/50:2*pi;
x=a*sin(t);
l=length(x);
plot(x,'r');
delta=0.2;
hold on
xn=0;
for i=1:l;
if x(i)>xn(i)
d(i)=1;
xn(i+1)=xn(i)+delta;
else
d(i)=0; xn(i+1)=xn(i)-delta;
end
end
stairs(xn)
hold on
for i=1:d
if d(i)>xn(i)
d(i)=0;
xn(i+1)=xn(i)-delta;
else
Page 43
EXPT. NO-14
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
d(i)=1; xn(i+1)=xn(i)+delta;
end
end
plot(xn,'c');
legend('Analog signal','Delta modulation','Demodulation')
title('DELTA MODULATION / DEMODULATION ')
output:
Result:
0 10 20 30 40 50 60-2
-1.5
-1
-0.5
0
0.5
1
1.5
2DELTA MODULATION / DEMODULATION
Analog signal
Delta modulation
Demodulation
Page 44
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
AMPLITUDE SHIFT KEYING
Aim: To generate and demodulate amplitude shift keyed (ASK) signal using MATLAB
Theory
Generation of ASK
Amplitude shift keying - ASK - is a modulation process, which imparts to a sinusoid two or
more discrete amplitude levels. These are related to the number of levels adopted by the digital
message. For a binary message sequence there are two levels, one of which is typically zero.
The data rate is a sub-multiple of the carrier frequency. Thus the modulated waveform consists
of bursts of a sinusoid. One of the disadvantages of ASK, compared with FSK and PSK, for
example, is that it has not got a constant envelope. This makes its processing (eg, power
amplification) more difficult, since linearity becomes an important factor. However, it does
make for ease of demodulation with an envelope detector.
Demodulation
ASK signal has a well defined envelope. Thus it is amenable to demodulation by an envelope
detector. Some sort of decision-making circuitry is necessary for detecting the message. The
signal is recovered by using a correlator and decision making circuitry is used to recover the
binary sequence.
Program
%ASK Modulation
clc;
clear all;
close all;
%GENERATE CARRIER SIGNAL
Tb=1; fc=10;
t=0:Tb/100:1;
c=sqrt(2/Tb)*sin(2*pi*fc*t);
%generate message signal
N=8;
m=rand(1,N);
t1=0;t2=Tb
Page 45
Expt no:15
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
for i=1:N
t=[t1:.01:t2]
if m(i)>0.5
m(i)=1;
m_s=ones(1,length(t));
else
m(i)=0;
m_s=zeros(1,length(t));
end
message(i,:)=m_s;
%product of carrier and message
ask_sig(i,:)=c.*m_s;
t1=t1+(Tb+.01);
t2=t2+(Tb+.01);
%plot the message and ASK signal
subplot(5,1,2);axis([0 N -2 2]);plot(t,message(i,:),'r');
title('message signal');xlabel('t--->');ylabel('m(t)');grid on
hold on
subplot(5,1,4);plot(t,ask_sig(i,:));
title('ASK signal');xlabel('t--->');ylabel('s(t)');grid on
hold on
end
hold off
%Plot the carrier signal and input binary data
subplot(5,1,3);plot(t,c);
title('carrier signal');xlabel('t--->');ylabel('c(t)');grid on
subplot(5,1,1);stem(m);
title('binary data bits');xlabel('n--->');ylabel('b(n)');grid on
% ASK Demodulation
t1=0;t2=Tb
for i=1:N
t=[t1:Tb/100:t2]
%correlator
x=sum(c.*ask_sig(i,:));
%decision device
if x>0
demod(i)=1;
else
demod(i)=0;
end
Page 46
Digital Communication Systems Lab
Department of ECE-CREC-Tirupati
t1=t1+(Tb+.01);
t2=t2+(Tb+.01);
end
%plot demodulated binary data bits
subplot(5,1,5);stem(demod);
title('ASK demodulated signal'); xlabel('n--->');ylabel('b(n)');grid on
Waveforms:
Result:
Page 47