You are on page 1of 10

V SWETHA – 19BEC1340

COURSE CODE: ECE4001

Course: Digital Communication Systems

Semester: Fall 2021-2022

FACULTY: Dr. P Nirmala

SLOT: L49 +L50

NAME: V SWETHA

REG. NO: 19BEC1340

EXPERIMENT NO: 01

DATE: 05-Aug-2021
V SWETHA – 19BEC1340

EXPERIMENT 1
AIM: To perform Amplitude shift keying modulation and demodulation in software.
SOFTWARE USED: MATLAB
THEORY: Amplitude Shift Keying (ASK) is the digital modulation technique. In amplitude
shift keying, the amplitude of the carrier signal is varied to create signal elements. Both
frequency and phase remain constant while the amplitude changes. In ASK, the amplitude of
the carrier assumes one of the two amplitudes dependent on the logic states of the input bit
stream. This modulated signal can be expressed as:

Amplitude shift keying (ASK) in the context of digital signal communications 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. Thus, the modulated
waveform consists of bursts of a sinusoid. Figure 1 illustrates a binary ASK signal (lower),
together with the binary sequence which initiated it (upper). Neither signal has been band
limited.
ALGORITHM

Initialization commands
ASK modulation
1. Generate carrier signal.
2. Start FOR loop
3. Generate binary data, message signal(on-off form)
4. Generate ASK modulated signal.
5. Plot message signal and ASK modulated signal.
6. End FOR loop.
7. Plot the binary data and carrier.

ASK demodulation
1. Start FOR loop
2. Perform correlation of ASK signal with carrier to get decision variable
3. Make decision to get demodulated binary data. If x>0, choose ‘1’ else choose ‘0’
4. Plot the demodulated binary data.

DESIGN PARAMETERS:
Samples=100
Carrier frequency= 1
V SWETHA – 19BEC1340

Amplitude=2
PROGRAM
clc
clear all
close all

x=randi([0,1],1,10)
for ii=1:length(x)
if x(ii)==1
x1(ii)=5;
else
x1(ii)=0;
end
end
i=1;
t=0:0.01:length(x1);
for j=1:length(t)
if t(j)<=i
y(j)=x1(i);
else
i=i+1;
y(j)=x1(i);
end
end
subplot(3,2,1);
plot(t,y);
title('msg- 19BEC1340');
xlabel('Time');
ylabel('Amplitude');

S=100; %Samples per bit


fc=1;
a=2;
xc=a*sin(2*pi*fc*t);
subplot(3,2,2);
plot(t,xc);
title('Carrier wave - 19BEC1340');
xlabel('Time');
ylabel('Amplitude');

ask=xc.*y; %BASK
subplot(3,2,3);
plot(t,ask);
title('B - ASK - 19BEC1340);
xlabel('Time');
ylabel('Amplitude');
V SWETHA – 19BEC1340

ask1=ask.*xc; %Product Modulator


subplot(3,2,4);
plot(t,ask);
title('Product Modulator - 19BEC1340);
xlabel('Time');
ylabel('Amplitude');

%integrator output
int_op=[];
for ii=0:S:length(ask1)-S
int_o=(1/S)*trapz(ask1(ii+1:ii+S));
int_op=[int_op int_o];
end

%decision device
th=0.5; %Thershold for bask
disp('Detected Bits: ')
det=(round(int_op,1)>=th)
%BER
disp('Bit Error Ratio: ')
det=(round(int_op,1)>=th);
ber= sum(x ~= det)/length(x)

for ii=1:length(det)
if det(ii)==1
det1(ii)=5;
else
det1(ii)=0;
end
end
i=1;
t=0:0.01:length(det1);
for j=1:length(t)
if t(j)<=i
detf(j)=det1(i);
else
i=i+1;
detf(j)=det1(i);
end
end
subplot(3,2,5.5);
plot(detf);
title('Received Signal – 19BEC1340');
xlabel('Time');
ylabel('Amplitude')
V SWETHA – 19BEC1340

OUTPUT GRAPH:

INFERENCE: It has high bandwidth efficiency.


RESULT
The program for ASK modulation and demodulation has been simulated in MATLAB and
necessary graphs are plotted.
V SWETHA – 19BEC1340

COURSE CODE: ECE4001

Course: Digital Communication Systems

Semester: Fall 2021-2022

FACULTY: Dr. P Nirmala

SLOT: L49 +L50

NAME: V SWETHA

REG. NO: 19BEC1340

EXPERIMENT NO: 02

DATE: 12-Aug-2021
V SWETHA – 19BEC1340

EXPERIMENT 2
AIM: To perform Pulse code Modulation using MATLAB.
SOFTWARE USED: MATLAB
THEORY: Pulse code modulation is a method that is used to convert an analog signal into a
digital signal so that a modified analog signal can be transmitted through the digital
communication network. PCM is in binary form, so there will be only two possible states
high and low(0 and 1). We can also get back our analog signal by demodulation. The Pulse
Code Modulation process is done in three steps Sampling, Quantization, and Coding. There
are two specific types of pulse code modulations such as differential pulse code
modulation(DPCM) and adaptive differential pulse code modulation(ADPCM).

DESIGN PARAMETERS:
Vmax=8
ALGORITHM
1. Quantization
2. Encoding
3. Demodulation
PROGRAM
%% Pulse Code Modulation (PCM) implementation
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 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);
V SWETHA – 19BEC1340

stem(s);
grid on;
title('Sampled Sinal');
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); % Contaion Quantized valuses
[ind,q]=quantiz(s,part,code); % Quantization process
% 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
for i=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'); % Cnvert the decimal to binary
k=1;
for i=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;
V SWETHA – 19BEC1340

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--->');

%% Demodulation Of PCM signal

qunt=reshape(coded,n,length(coded)/n);
index=bi2de(qunt','left-msb'); % Getback the index in decimal form
q=del*index+vmin+(del/2); % getback Quantized values
subplot(2,1,2); grid on;
plot(q); % Plot Demodulated signal
title('Demodulated Signal');
ylabel('Amplitude--->');
xlabel('Time--->');

OUTPUT GRAPH:
V SWETHA – 19BEC1340

INFERENCE: Higher signal levels are quantized with less quantization steps, as the signal
is increased there is a reduction in perceived quality

RESULT
The program for PCM has been simulated in MATLAB and necessary graphs are plotted.

You might also like