Cycle 2 Adc 18tel67
Cycle 2 Adc 18tel67
PART B
EXPERIMENT: 01
PULSE CODE MODULATION AND DEMODULATION
THEORY:
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. 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 as digital. Each one of these digits, though in binary code, represents
the approximate amplitude of the signal sample at that instant.
Department of Electronics and Telecommunication Engineering, B.I.T 1
ANALOG & DIGITAL COMMUNICATION LAB [18TEL67] 2020-21
Low Pass Filter: 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. Sampling is defined as, “The process of
measuring the instantaneous values of continuous-time signal in a discrete form.
“Sample” is a piece of data taken from the whole data which is continuous in the time
domain. To discretize the signals, the gap between the samples should be fixed. That gap
can be termed as a sampling period Ts.
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. The digitization of analog signals involves the rounding off of the values
which are approximately equal to the analog values. The method of sampling chooses a
few points on the analog signal and then these points are joined to round off the value to
a near stabilized value. Such a process is called as Quantization. The type of
quantization in which the quantization levels are uniformly spaced is termed as a
Uniform Quantization. The type of quantization in which the quantization levels are
unequal and mostly the relation between them is logarithmic, is termed as a Non-
uniform Quantization.
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. Encoding minimizes the bandwidth used.
Regenerative Repeater: This section increases the signal strength. The output of the
channel also has one regenerative repeater circuit, to compensate the signal loss and
reconstruct the signal, and also to increase its strength.
Decoder: The decoder circuit decodes the pulse coded waveform to reproduce the
original signal. This circuit acts as the demodulator.
Algorithm:
4. Convert the decimal value to binary and convert the coded matrix into a coded row
vector
CODE:
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;
% Sampling Operation
x=0:2*pi/n1:4*pi; % n1 number of samples have to be selected
s=8*sin(x);
subplot(3,1,1);
plot(s);
title('Analog Signal');
ylabel('Amplitude--->');
xlabel('Time--->');
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; % level are between vmin and vmax with difference of del
code=vmin-(del/2):del:vmax+(del/2); % Contain Quantized values
[ind,q]=quantiz(s,part,code); % ind contain index number and q contain quantized
values
l1=length(ind);
l2=length(q);
for i=1:l1
if(ind(i)~=0) % To make index as binary decimal so started from 0 to N
ind(i)=ind(i)-1;
end
i=i+1;
end
fori=1:l2
if(q(i)==vmin-(del/2)) % To make quantize value in between the levels
q(i)=vmin+(del/2);
end
end
subplot(3,1,3);
stem(q);
grid on; % Display the Quantize values
title('Quantized Signal');
ylabel('Amplitude--->');
xlabel('Time--->');
% Encoding Process
figure
code=de2bi(ind,'left-msb'); % Convert the decimal to binary
k=1;
fori=1:l1
for j=1:n
coded(k)=code(i,j); % convert code matrix to a coded row vector
j=j+1;
k=k+1;
end
i=i+1;
end
subplot(2,1,1); grid on;
stairs(coded); % Display the encoded signal
axis([0 100 -2 3]);
title('Encoded Signal');
ylabel('Amplitude--->');
xlabel('Time--->');
qunt=reshape(coded,n,length(coded)/n);
index=bi2de(qunt','left-msb'); % Get back the index in decimal form
q=del*index+vmin+(del/2); % get back Quantized values
subplot(2,1,2);
grid on;
plot(q); % Plot Demodulated signal
title('Demodulated Signal');
ylabel('Amplitude--->');
xlabel('Time--->');
OUTPUT WAVEFORMS:
EXPERIMENT: 02
DELTA MODULATION AND ADAPTIVE DELTA MODULATION
AIM: To Simulate Delta modulation and Adaptive Delta modulation.
THEORY:
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 are encoded into
n-bit data streams. In delta modulation, the transmitted data are reduced to a 1-bit data
stream. Its main features are:
ADM quantizes the difference between the value of the current sample and the
predicted value of the next sample. It uses a variable step height to predict the next
values, for the faithful reproduction of the fast varying values.
Algorithm:
4. Call the function in the main program and execute to obtain Delta modulated
signal.
end
if(sum>xsig(i))
cnt2=cnt2+1;
else
cnt2=0;
end
end
ADMout(((i-1)*Nfac+1):(i*Nfac))=sum;
end
end
end
Main program:
clear;
td=0.002;
t=[0:td:1];
sig_in=sin(4*pi*t);
Lsig=length(sig_in);
ts=0.02;
Delta=0.5;
[ADMout]=adeltamod(sig_in,Delta,td,ts);
plot(t,sig_in,'k',t,ADMout(1:Lsig),'b');
OUTPUT WAVEFORMS:
Graph of DM (∆=0.2)
Graph of ADM
RESULT:
Delta modulation and Adaptive Delta modulation is simulated and graphs are
Plotted.
EXPERIMENT: 03
EYE DIAGRAM
AIM: To Simulate the transmission of baseband signals with Raised cosine Transmitter
Filter and Plot Eye Diagram.
COMPONENTS: MATLab tool
THEORY:
The information symbol with a symbol period can be transmitted without
Inter symbol interference (ISI) by using Nyquist pulse,
Though the sinc filter achieves bandlimited transmission within Hz without inter
symbol interference, the sinc filter has the following issues:
1. The tail of the sinc filter decays slowly. Note that practical implementations cannot
use a filter which extends from to . To ensure that only filter taps having small
values are only ignored, need to use a filter of large length.
2. Small errors in timing synchronization at the receiver will result in significant
intersymbol interference. Reason: The error in timing synchronization means that the
sampling tme at the receiver is not aligned. This implies that filter tap values at
time etc are non-zero. Hence results in significant inter
symbol interference.
Given so, there was a motivation to find filters which satisfies the Nyquist criterion, but
has a faster decay of the filter tail. A commonly used pulse shaping filter satisfying the
Nyquist criterion while having a faster decay is called the Raised cosine filters having
the following equation,
Where
is the excess bandwidth parameter and takes values from 0 to 1.
With =0, the raised cosine filter reduces to the classical Nyquist filter with zero excess
bandwidth outside .
With =1 it is called 100% excess bandwidth and does not occupy frequencies
outside .
Eye diagram
An eye diagram is generated in an oscilloscope operating in the persistence mode by
observing the output of the filter with the symbol timing serving as the trigger. The
observation window can be set as 2 times the symbol period. An eye pattern, also known
as an eye diagram, is an oscilloscope display in which a digital signal from a receiver is
repetitively sampled and applied to the vertical input, while the data rate is used to trigger
the horizontal sweep. It is so called because, for several types of coding, the pattern looks
like a series of eyes between a pair of rails. It is a tool for the evaluation of the combined
effects of channel noise and Intersymbol interference on the performance of a baseband
pulse-transmission system. It is the synchronised superposition of all possible realisations
of the signal of interest viewed within a particular signaling interval.
Several system performance measures can be derived by analyzing the display. If the
signals are too long, too short, poorly synchronized with the system clock, too high, too
low, too noisy, or too slow to change, or have too much undershoot or overshoot, this can
be observed from the eye diagram. An open eye pattern corresponds to minimal
signal distortion. Distortion of the signal waveform due to Intersymbol
interference and noise appears as closure of the eye pattern. When the input data is
random, the eye diagram which consists of many overlapped traces of the signal captures
visually all the paths which the waveform takes.
There are many measurements that can be obtained from an eye diagram
Amplitude measurements
Eye amplitude
Eye crossing amplitude
Eye crossing percentage
Eye height
Eye level
Eye signal-to-noise ratio
Quality factor
Vertical eye opening
Time measurements
Deterministic jitter
Eye crossing time
Eye delay
Eye fall time
Eye rise time
Eye width
Horizontal eye opening
Peak-to-peak jitter
Random jitter
RMS jitter
CRC jitter
Total jitter
Interpreting Measurements
Algorithm:
1. Defines random BPSK modulated symbols (+1′s and -1′s).
2. Defines two raised cosine filters with = 0.5, = 1.
3. Upsamples the transmit sequence by zero insertion.
4. Convolves the upsampled transmit sequence with the filter.
5. Overlays the time domain samples to plot the eye diagram.
CODE:
clear
N = 10^3; % number of symbols
am = 2*(rand(1,N)>0.5)-1 + j*(2*(rand(1,N)>0.5)-1); % generating random binary
sequence
fs = 10; % sampling frequency in Hz
% defining the sincfilter
sincNum = sin(pi*[-fs:1/fs:fs]); % numerator of the sinc function
sincDen = (pi*[-fs:1/fs:fs]); % denominator of the sinc function
sincDenZero = find(abs(sincDen) < 10^-10);
sincOp = sincNum./sincDen;
sincOp(sincDenZero) = 1; % sin(pix/(pix) =1 for x =0
% raised cosine filter
alpha = 0.5;
cosNum = cos(alpha*pi*[-fs:1/fs:fs]);
Department of Electronics and Telecommunication Engineering, B.I.T 18
ANALOG & DIGITAL COMMUNICATION LAB [18TEL67] 2020-21
cosDen = (1-(2*alpha*[-fs:1/fs:fs]).^2);
cosDenZero = find(abs(cosDen)<10^-10);
cosOp = cosNum./cosDen;
cosOp(cosDenZero) = pi/4;
gt_alpha5 = sincOp.*cosOp;
alpha = 1;
cosNum = cos(alpha*pi*[-fs:1/fs:fs]);
cosDen = (1-(2*alpha*[-fs:1/fs:fs]).^2);
cosDenZero = find(abs(cosDen)<10^-10);
cosOp = cosNum./cosDen;
cosOp(cosDenZero) = pi/4;
gt_alpha1 = sincOp.*cosOp;
% upsampling the transmit sequence
amUpSampled = [am;zeros(fs-1,length(am))];
amU = amUpSampled(:).';
% filtered sequence
st_alpha5 = conv(amU,gt_alpha5);
st_alpha1 = conv(amU,gt_alpha1);
% taking only the first 10000 samples
st_alpha5 = st_alpha5([1:10000]);
st_alpha1 = st_alpha1([1:10000]);
st_alpha5_reshape = reshape(st_alpha5,fs*2,N*fs/20).';
st_alpha1_reshape = reshape(st_alpha1,fs*2,N*fs/20).';
close all
figure;
plot([0:1/fs:1.99],real(st_alpha5_reshape).','b');
title('eye diagram with alpha=0.5');
xlabel('time')
ylabel('amplitude')
axis([0 2 -1.5 1.5])
grid on
figure;
plot([0:1/fs:1.99],real(st_alpha1_reshape).','b');
title('eye diagram with alpha=1')
xlabel('time')
ylabel('amplitude')
axis([0 2 -1.5 1.5 ])
grid on
OBSERVATIONS:
1. For increasing the margin for error free transmission, the vertical opening of the
eye should be more. In the presence of inter-symbol interference, the vertical
opening of the eye reduces, thus increasing the probability of error.
2. The ideal sampling instant is the point where the vertical eye opening is
maximum.
3. Smaller horizontal eye opening means implies more sensitivity to timing errors.
Inference: From the figures, it can be observed that the horizontal eye opening
with =0.5 is smaller than with =1.
The tails of the raised cosine filter with =1 dies away faster than the case where =0.5.
Hence error in timing cause a bigger performance degradation for =0.5 than for =1
scenario. However, the flip side of using =1 is the increased bandwidth required for
transmission.
OUTPUT WAVEFORMS:
RESULT: The baseband signals are transmitted through Raised cosine Transmitter Filter
and Eye Diagram is plotted.
EXPERIMENT: 04
BER OF ASK, PSK, FSK
AIM: To compute the Probability of bit error for binary ASK, FSK and PSK for an
AWGN Channel and Compare them with their Performance curves.
COMPONENTS: MATLab tool.
THEORY:
The short form of Amplitude Shift Keying is referred as ASK. It is the digital
modulation technique. In this technique, amplitude of the RF carrier is varied in
accordance with baseband digital input signal. The figure 12.1 depicts operation of ASK
modulation. As shown in the figure, binary 1 will be represented by carrier signal with
some amplitude while binary 0 will be represented by carrier of zero amplitude.
The short form of Frequency Shift Keying is referred as FSK. It is also digital
modulation technique. In this technique, frequency of the RF carrier is varied in
accordance with baseband digital input. The figure 12.3 depicts the FSK modulation. As
shown, binary 1 and 0 is represented by two different carrier frequencies. Figure depicts
that binary 1 is represented by high frequency 'f1' and binary 0 is represented by low
frequency 'f2'.
Fig.12.5: PSK
AWGN Channel
A basic and generally accepted model for noise in communication channels, is the set of
assumptions that
The noise is additive, i.e., the received signal equals the transmit signal plus some
noise, where the noise is statistically independent of the signal.
The noise is white, i.e., the power spectral density is flat, and so the autocorrelation
of the noise in time domain is zero for any non-zero time offset.
Department of Electronics and Telecommunication Engineering, B.I.T 25
ANALOG & DIGITAL COMMUNICATION LAB [18TEL67] 2020-21
In digital transmission, the number of bit errors is the number of received bits of a data
stream over a communication channel that have been altered due
to noise, interference, distortion or bit synchronization errors.
The bit error rate (BER) is the number of bit errors per unit time. The bit error
ratio (also BER) is the number of bit errors divided by the total number of transferred
bits during a studied time interval. Bit error ratio is a unit-less performance measure,
often expressed as a percentage. The bit error probability pe is the expectation value of
the bit error ratio. The bit error ratio can be considered as an approximate estimate of the
bit error probability. This estimate is accurate for a long time interval and a high number
of bit errors.
Algorithm
%MODULATION
ask=[];psk=[];fsk=[];
fori=1:n
if b(i)==1
ask=[ask sa1];
psk=[psk sp1];
fsk=[fsk sf1];
else
ask=[ask sa0];
psk=[psk sp0];
fsk=[fsk sf0];
end
end
figure(1);
subplot(411);
stairs(0:10,[b(1:10) b(10)]);
axis([0 10 -0.5 1.5]);
title('Message Bits');grid on;
subplot(412);
tb=0:1/30:10-1/30;
plot(tb, ask(1:10*30),'b','linewidth',1.5);
title('ASK Modulation');grid on;
subplot(412);
plot(tb, fsk(1:10*30),'r','linewidth',1.5);
title('FSK Modulation');grid on;
subplot(414);
plot(tb, psk(1:10*30),'k','linewidth',1.5);
title('PSK Modulation');grid on;
Department of Electronics and Telecommunication Engineering, B.I.T 27
ANALOG & DIGITAL COMMUNICATION LAB [18TEL67] 2020-21
xlabel('Time');ylabel('Amplitude');
%AWGN
forsnr=0:20
askn=awgn(ask,snr);
pskn=awgn(psk,snr);
fskn=awgn(fsk,snr);
%DETECTION
A=[];F=[];P=[];
fori=1:n
%ASK Detection
if sum(sa1.*askn(1+30*(i-1):30*i))>0.5
A=[A 1];
else
A=[A 0];
end
%FSK Detection
if sum(sf1.*fskn(1+30*(i-1):30*i))>0.5
F=[F 1];
else
F=[F 0];
end
%PSK Detection
if sum(sp1.*pskn(1+30*(i-1):30*i))>0
P=[P 1];
else
P=[P 0];
end
end
%BER
errA=0;errF=0; errP=0;
fori=1:n
if A(i)==b(i)
errA=errA;
else
errA=errA+1;
end
if F(i)==b(i)
errF=errF;
else
Department of Electronics and Telecommunication Engineering, B.I.T 28
ANALOG & DIGITAL COMMUNICATION LAB [18TEL67] 2020-21
errF=errF+1;
end
if P(i)==b(i)
errP=errP;
else
errP=errP+1;
end
end
BER_A(snr+1)=errA/n;
BER_F(snr+1)=errF/n;
BER_P(snr+1)=errP/n;
end
figure(2);
subplot(411);
stairs(0:10,[b(1:10) b(10)]);
axis([0 10 -0.5 1.5]);grid on;
title('Received signal after AWGN Channel');
subplot(412);
tb=0:1/30:10-1/30;
plot(tb, askn(1:10*30),'b','linewidth',1.5);
title('Received ASK signal');grid on;
subplot(413);
plot(tb, fskn(1:10*30),'r','linewidth',1.5);
title('Received FSK signal');grid on;
subplot(414);
plot(tb, pskn(1:10*30),'k','linewidth',1.5);
title('Received PSK signal');grid on;
figure(3);
semilogy(0:20,BER_A, 'b','linewidth',2);
title('BER Vs SNR');
grid on;
hold on
semilogy(0:20,BER_F,'r','linewidth',2);
semilogy(0:20,BER_P, 'k','linewidth',2);
xlabel('Eo/No(dB)');
ylabel('BER');
hold off;
legend('ASK','FSK','PSK');
OUTPUT WAVEFORMS:
RESULT:
ASK, PSK and FSK signals are generated, transmitted through the AWGN channel
and BER vs SNR graphs for these signals are plotted and compared.