0% found this document useful (0 votes)
33 views

DComm Practical

The document describes an experiment to analyze a PCM system with a sampling frequency of 4 kHz. A sine wave signal is sampled and quantized using an N-bit uniform quantizer. The quantized samples are encoded into binary and transmitted serially as the PCM waveform. At the receiver, the binary data is decoded, reconstructed by re-quantization, and compared to the original signal. Plots of the original, quantized, transmitted, and reconstructed signals are generated. The experiment analyzes the waveforms at each stage of the PCM system.

Uploaded by

Durgesh Dhore
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)
33 views

DComm Practical

The document describes an experiment to analyze a PCM system with a sampling frequency of 4 kHz. A sine wave signal is sampled and quantized using an N-bit uniform quantizer. The quantized samples are encoded into binary and transmitted serially as the PCM waveform. At the receiver, the binary data is decoded, reconstructed by re-quantization, and compared to the original signal. Plots of the original, quantized, transmitted, and reconstructed signals are generated. The experiment analyzes the waveforms at each stage of the PCM system.

Uploaded by

Durgesh Dhore
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/ 28

GOVERNMENT COLLEGE OF ENGINEERING

AMRAVATI

ETU- 528
Digital Communication LAB
NAME:- Chinmay Shrikant Pande
ID : 19004066
BATCH No. :- 04
EXPERIMENT NO. 01

AIM: To study the sampling theorem and its reconstruc on.

APPARATUS: MATLAB SIMULINK

THEORY:-
1. 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 me separated by +fm
sec.

2. The sampling theorem states that if the sampling rate in any pulse modula on system
exceeds twice the maximum signal frequency, the original signal can be reconstructed in the
receiver with minimum distor on.

3. Fs> 2fm is called Nyquist rate Where Fs sampling frequency, Fm modula ng signal frequency.

4. If we reduce the sampling frequency Fs less than 2fm the side bands and the informa on
signal will overlap and we cannot recover the informa on signal by low pass filter. This
phenomenon is called fold over distor on or aliasing.

PROGRAM Of MATLAB:-

%% Sampling and reconstruc on demo


clear,clc,close all;

%% Parameters
F = 30; % frequency of signal [Hz]
Fs = 2*F; % sampling rate [Hz]
Ts = 1/Fs; % sampling period [sec]

%% Generate "con nuous me" signal and discrete me signal


tc = 0:1e-4:5/F; % CT axis
xc = cos(2*pi*F*tc); % CT signal
td = 0:Ts:5/F; % DT axis
xd = cos(2*pi*F*td); % DT signal
N = length(td); % number of samples

%% Reconstruc on by using the formula:


% xr(t) = sum over n=0,...,N-1: x(nT)sin(pi(t-nT)/T)/(pi*(t-nT)/T)
% Note that sin(pi*(t-nT)/T)/(pi*(t-nT)/T) = sinc((t-nT)/T)
% sinc(x) = sin(pi*x)/(pi*x) according to MATLAB
xr = zeros(size(tc));
sinc_train = zeros(N,length(tc));
for t = 1:length(tc)
for n = 0:N-1
sinc_train(n+1,:) = sin(pi*(tc-n*Ts)/Ts)./(pi*(tc-n*Ts)/Ts);
xr(t) = xr(t) + xd(n+1)sin(pi(tc(t)-n*Ts)/Ts)/(pi*(tc(t)-n*Ts)/Ts);
end
end

%% Plot the results


figure
hold on
grid on
plot(tc,xc)
stem(td,xd)
plot(tc,xr)
xlabel('Time [sec]')
ylabel('Amplitude')

%% Sinc train visualiza on


figure
hold on
grid on
plot(tc,xd.'.*sinc_train)
stem(td,xd)
xlabel('Time [sec]')
ylabel('Amplitude')

Observa on:
RESULT:
Analog signal sampling and reconstruc on with different sampling techniques are
observed.
EXPERIMENT NO. 02
AIM:-
To study Pulse Amplitude modula on and demodula on process with relevant
waveforms .

APPARATUS:- MATLAB Simulink

THEORY:-
1.Pulse modula on is used to transmit analog informa on.Sampling is taken at a regular interval
for the con nuous me signals. Informa on regarding the signal is transmi ed only at the
sampling mes together with syncing signals.
2.At the receiving end, the original waveforms may be recons tuted from the informa on
regarding the samples.

PROGRAM Of MATLAB:-
clc;
close all;
clear all;
t=0:1/6000:((10/1000)-(1/6000));
xa=sin(2*pi*100*abs(t));
Ts=32;
x=sin(2*pi*600*(Ts*t));
X= (xa,abs(x));
subplot(3,1,1);
plot(x,a);
grid
subplot(3,1,2);
stem(X);
grid
Y=i (xa,X);
subplot(3,1,3);
plot(Y);
grid

Observation :-
RESULT :-
Pulse amplitude modula on and demodula on is observed and their respec ve wave forms
are plo ed.
Experiment No. 03

AIM:- To verify Pulse width Modula on and Demodula on.

APPARATUS:- MATLAB SIMULINK

Theory :-

PWM MODULATOR

PWM DEMODULATOR

Program Of MATLAB :-

clc;
close all;
clear all;
fc=1000; fs=10000; f1=200;
t=0:1/fs:((2/f1)-(1/fs));
x1=0.4*cos(2*pi*f1*t)+0.5; %modula on
y1=modulate(x1,fc,fs,'pwm');
subplot(421);
plot(x1);
tle('original signal token message,f1=500,fs=10000') ;
subplot(422);
plot(y1);
axis([0 500 -0.2 1.2]);
tle('PWM')
%demodula on x1_recov=demod(y1,fc,fs,'pwm'); subplot(423);
plot(x1_recov);
tle(' me domain received recoverd,signal tone,f1=200');

Observation:-

RESULT:- Pulse width modula on and demodula on is observed and their respec ve wave
forms are plo ed.
Experiment No. 04
AIM:- Verify Pulse Posi on Modula on (PPM) and Demodula on.

APPARATUS:- MATLAB SIMULINK

Theory :-
Pulse modula on is used to transmit analog informa on, such as con nuous speech or
data. The data is sent at sampling mes, with synchronizing pulses. The pulse posi on
modula on is an analog modula on method, where we have fixed amplitude of each
pulse, but the posi on of each pulse is made propor onal to the amplitude of the
modula ng signal at that instant. PPM is derived from the pulse width modulated signal.
To demodulate the PPM signal, it is fed to an integra ng RC circuit (LPF) to obtain the
modula ng signal.

Program Of MATLAB :-
clc;
clear all;
close all;
fc=100; fs=1000;
f1=80; f2=300 ;
t=0:1/fs:((2/f1)-(1/fs));
x1=0.4*cos(2*pi*f1*t)+0.5;
%x2=0.2*(cos(2*pi*f1*t)+cos(2*pi*f2*t))+0.5 ;
subplot(4,2,1);
plot(x1);
tle('original msg signal');
y1=modulate(x1,fc,fs,'ppm');
subplot(4,2,2);
plot(y1)
axis([0 50 -0.2 1.2]);
tle('ppm one of f1,fc=1000,f1=80 ');
fx1=abs( (y1,1024)) ;
fx1=[fx1(512:1024) fx1(1:513)];
f=[(511*fs/1024):(fs/1024):(512*fs/1024)];
subplot(4,2,3);
plot(fx1);
tle('freq des ppm signal tone,fc=1000');
x1_recov = demod(y1,fc,fs,'ppm');
subplot(4,2,4);
plot(x1_recov);
tle(' me domain recovered signal');

Observation:-

RESULT:- Pulse posi on modula on and demodula on is observed and their respec ve
waveforms are plo ed.
Experiment No. 05
AIM:- To verify Delta modula on(DM) and Adap ve Delta Modula on(ADM)

APPARATUS:- MATLAB SIMULINK

Theory:-

Delta Modula on is a form of pulse modula on where a sample value is represented as a


single bit. This is almost similar to differen al PCM, as the transmi ed bit is only one per
sample just to indicate whether the present sample is larger or smaller than the previous
one. The encoding, decoding and quan zing process become extremely simple but this
system cannot handle rapidly varying samples. This increases the quan zing noise. The
trainer is a self sustained and well organized kit for the demonstra on of delta modula on
& demodula on.

Program Of MATLAB:-

%% Delta Modula on (DM)


%delta modula on = 1-bit differen al pulse code modula on (DPCM)
predictor = [0 1]; % y(k)=x(k-1)
%par on = [-1:.1:.9];codebook = [-1:.1:1];
step=0.2; %SFs>=2pifA
par on = [0];
codebook = [-1*step step]; %DM quan zer
t = [0:pi/20:2*pi];
x = 1.1*sin(2*pi*0.1*t); % Original signal, a sine wave
%t = [0:0.1:2*pi];x = 4*sin(t);
%x=exp(-1/3*t);
%x = sawtooth(3*t); % Original signal
% Quan ze x(t) using DPCM.
encodedx = dpcmenco(x,codebook,par on,predictor);
% Try to recover x from the modulated signal.
decodedx = dpcmdeco(encodedx,codebook,predictor);
distor = sum((x-decodedx).^2)/length(x) % Mean square error
% plots
figure,
subplot(3,1,1);
plot(t,x);
xlabel(' me');
tle('original signal');
subplot(3,1,2);
stairs(t,10*codebook(encodedx+1),'--');
xlabel(' me');
tle('DM output');
subplot(3,1,3);
plot(t,x);
hold;
stairs(t,decodedx);
grid;
xlabel(' me');
tle('received signal');

Observation:-

RESULT:- Thus the Delta modula on and demodula on were performed and graphs were
plo ed.
EXPERIMENT NO. 06
AIM:- To analyze a PCM system and interpret the modulated and demodulated waveforms for
a sampling frequency of 4 KHz.

APPARATUS:- MATLAB SIMULINK

THEORY:-

PCM Operation:-

1). The block diagram of the PCM system. The modula ng signal is applied to sample &
hold circuit. This applied signal will be super imposed by +2.5V DC so that the nega ve por on
modula ng signal will clamped to posi ve, this process is needed, because input of the A/D
Converter should be between 0 and +5V. A er level shi ing is done the signal will be passed to
sample & hold circuit. Sample & hold circuit will sample the input signal during the period of the
clock signal and will hold the sampled output ll the next pulse comes. Sampling rate is 4KHz in
this system.

2). So input of the A/D Converter is a stable voltage of certain level in between 0 and +5V.
A/D converter (encoder) will give a predetermined 8 bit code for the sampled input. This en re
conversion process will be made at a fast rate as ADC0808 is opera ng at high frequency clock
i.e. 1MHz. Coded output of the A/D converter is applied to input of the parallel in serial out
register through a latch (741s373). This shi register is opera ng at 64KHz (sampling frequency
is 4KHz, so to shi 8 bits from parallel to serial we need 64KHz). This output (PCM) is
transmi ed through a co-axial cable which represents a communica on channel.

PROGRAM Of MATLAB:-

sig = 4*sin(t); % Original signal, a sine wave


%sig=exp(-1/3*t);
% quan za on
Vh=max(sig);
Vl=min(sig);
N=3;M=2^N;
S=(Vh-Vl)/M; %design N-bit uniform quan zer with stepsize=S
par on = [Vl+S:S:Vh-S]; % Length M-1, to represent M intervals
codebook = [Vl+S/2:S:Vh-S/2]; % Length M, one entry for each interval
% par on = [-1:.2:1]; % Length 11, to represent 12 intervals
% codebook = [-1.2:.2:1]; % Length 12, one entry for each interval
[index,quan zed_sig,distor] = quan z(sig,par on,codebook); % Quan ze.
% binary encoding
codedsig=de2bi(index,'le -msb');
codedsig=codedsig';
txbits=codedsig(:); %serial transmit
errvec=randsrc(length(txbits),1,[0 1;(1-P/100) P/100]); %error vector
%rxbits=xor(txbits,errvec);
rxbits=rem(txbits+errvec,2); %bits received
rxbits=reshape(rxbits,N,length(sig));
rxbits=rxbits';
index1=bi2de(rxbits,'le -msb'); %decode
reconstructedsig=codebook(index1+1); %re-quan ze
%plot(t,sig,'x',t,quan zed_sig,'.')
%plot(t,sig,'x-',t,quan zed_sig,'.--',t,reconstructedsig,'d-')
%figure,stem(t,sig,'x-');hold;stem(t,quan zed_sig,'.--');stem(t,reconstructedsig,'d-');
figure,
subplot(2,2,1);
stem(t,sig);
xlabel(' me');
tle('original signal');
subplot(2,2,2);
stem(t,quan zed_sig);
xlabel(' me');
tle('quan zed signal');
=[0:N*length(t)-1];
subplot(2,2,3);
stairs( ,txbits);
xlabel(' me');
tle('PCM waveform');
subplot(2,2,4);
stem(t,reconstructedsig);
xlabel(' me');
tle('received signal');

OUTPUT WAVE FORM:-


RESULT:- Thus the Pulse Code modula on and demodula on were performed and graphs
were plo ed.
EXPERIMENT NO. 07
Aim:- To Verify Amplitude shi Keying Modula on and Demodula on

Apparatus:- Matlab Simulink

Theory:-

Amplitude Shift Keying:-

When it is required to transmit digital signals of the sinusoidal carrier is varied in


accordance with the incoming digital data since the digital data is in discrete steps, the
modula on of band pass sinusoidal carrier is also done in discrete steps. Therefore, this
type of modula on is called switching or signaling. If the amplitude of the carrier is
switched depending on the incoming digital signal then it is called amplitude shi keying
(ASK). This is similar to analog amplitude modula on. In this method, there is only one
unit energy carrier and sit is switched on (or) off depending upon the input binary
sequence. The ASK waveform can represented as S(t) = √2Ps cos (2πfot), (to transmit
„1‟). To transmit symbol „0‟, the signal s(t) = 0 where Ps is power dissipated and fo is
carrier frequency. The Original Signal is first transmi ed and quan zed as with PCM. If
the sample currently being coded is above the previous sample, then a binary bit is set
to logic „1‟ .If the sample is lower than the previous sample then the bit is set low.

Program of MATLAB:-

ASK MODULATION

%ASK Modula on
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
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');
tle('message signal');xlabel('t--->');ylabel('m(t)');grid on
hold on
subplot(5,1,4);plot(t,ask_sig(i,:));
tle('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);
tle('carrier signal');xlabel('t--->');ylabel('c(t)');grid on
subplot(5,1,1);stem(m);
tle('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

t1=t1+(Tb+.01);

t2=t2+(Tb+.01);

end

%plot demodulated binary data bits

subplot(5,1,5);stem(demod);

tle('ASK demodulated signal'); xlabel('n--->');ylabel('b(n)');grid on

Observa on:-

Result:- Thus the ASK modula on and demodula on is verified and the waveforms
are plo ed.
EXPERIMENT NO. 08
Aim:- To Verify Frequency shi Keying Modula on and Demodula on

Apparatus:- Matlab Simulink

Theory:-

Frequency Shift Keying:-

When a digital signal is to be transmi ed over a long distance, it needs con nuous
wave modula on.

A carrier of frequency ‘fo’ is used for modula on. Then the digital signal
modulates some parameter like frequency, phase or amplitude of the carrier. The
carrier ‘fo’ has some devia on in frequency. The devia on is called bandwidth of
the channel. Thus the channel has to transmit some range of frequency. Hence
such a type of transmission is called band pass transmission and the
communica on channel is called band pass channel.

Since the digital data is in discrete steps, the modula on of band pass sinusoidal
carrier is also done in discrete steps. Hence this type of modula on is called
switching or signaling. If the frequency of the sinusoidal carrier is switched on
depending on the incoming digital signal, then it is called frequency shi keying
(FSK). This is similar to analog frequency modula on. In FSK the frequency of
carrier is shi ed according to binary symbol. That is there are 2 different
frequency symbols according to binary symbols. Let there be a frequency shi by
Ω, then we can write the following equa ons.

If b (t) = 1, sH (t) = √2Ps Cos (2πfo + Ω) t

If b(t) = 0, sL (t) = √2Ps Cos (2πfo + Ω) t

Program Of MATLAB:-
FSK MODULATION

% FSK Modula on

clc;

clear all;

close all;

%GENERATE CARRIER SIGNAL

Tb=1; fc1=2;fc2=5;

t=0:(Tb/100):Tb;

c1=sqrt(2/Tb)*sin(2*pi*fc1*t);

c2=sqrt(2/Tb)*sin(2*pi*fc2*t);

%generate message signal

N=10;

m=rand(1,N);

t1=0;t2=Tb

for i=1:N

t=[t1:(Tb/100):t2]

if m(i)>0.5

m(i)=1;

m_s=ones(1,length(t));

invm_s=zeros(1,length(t));

else
m(i)=0;

m_s=zeros(1,length(t));

invm_s=ones(1,length(t));

end

message(i,:)=m_s;

%Mul plier

fsk_sig1(i,:)=c1.*m_s;

fsk_sig2(i,:)=c2.*invm_s;

fsk=fsk_sig1+fsk_sig2;

%plo ng the message signal and the modulated signal

subplot(3,2,2);axis([0 N -2 2]);plot(t,message(i,:),'r');

tle('message signal');xlabel('t---->');ylabel('m(t)');grid on;hold on;

subplot(3,2,5);plot(t,fsk(i,:));

tle('FSK signal');xlabel('t---->');ylabel('s(t)');grid on;hold on;

t1=t1+(Tb+.01); t2=t2+(Tb+.01);

end

hold off

%Plo ng binary data bits and carrier signal

subplot(3,2,1);stem(m);

tle('binary data');xlabel('n---->'); ylabel('b(n)');grid on;

subplot(3,2,3);plot(t,c1);

tle('carrier signal-1');xlabel('t---->');ylabel('c1(t)');grid on;


subplot(3,2,4);plot(t,c2);

tle('carrier signal-2');xlabel('t---->');ylabel('c2(t)');grid on;

FSK DEMODULATION

% FSK Demodula on

t1=0;t2=Tb

for i=1:N

t=[t1:(Tb/100):t2]

%correlator

x1=sum(c1.*fsk_sig1(i,:));

x2=sum(c2.*fsk_sig2(i,:));

x=x1-x2;

%decision device

if x>0

demod(i)=1;

else

demod(i)=0;

end

t1=t1+(Tb+.01);

t2=t2+(Tb+.01);

end

%Plo ng the demodulated data bits

subplot(3,2,6);stem(demod);
tle(' demodulated data');xlabel('n---->');ylabel('b(n)'); grid on;
Observation:-

Result:- Thus the FSK modula on and demodula on is verified and the
waveforms are plo ed
EXPERIMENT NO. 09

Aim:- To Verify Phase shi Keying Modula on and Demodula on

Apparatus:- Matlab Simulink

Theory:-

It is not possible to send the digital data directly over the antenna because the
antennae of prac ced size works on very high frequencies, much higher than our
data transmission rate. To be able to transmit the data over antennae, we have to
modulate the signal i.e, phase, frequency or amplitude etc is varied in accordance
with the digital data. At the receiver we separate the signal from digital
informa on by the process of demodula on. A er this process we are le with
high frequency signal (carrier signal) which we discard & the digital informa on,
which we u lize.

PSK is a form of angle modulated, constant amplitude digital modula on. Digital
communica on became important with the expansion of the use of computers
and data processing and has con nued to develop into a major industry providing
the interconnec on of computer peripherals and transmission of data between
distant sites.

Program Of MATLAB:-

% PSK modula on

clc;

clear all;

close all;

%GENERATE CARRIER SIGNAL


Tb=1;

t=0:Tb/100:Tb;

fc=2;

c=sqrt(2/Tb)*sin(2*pi*fc*t);

%generate message signal

N=8;

m=rand(1,N);

t1=0;t2=Tb

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=-1*ones(1,length(t));

end

message(i,:)=m_s;

%product of carrier and message signal

bpsk_sig(i,:)=c.*m_s;

%Plot the message and BPSK modulated signal

subplot(5,1,2);axis([0 N -2 2]);plot(t,message(i,:),'r');
tle('message signal(POLAR form)');xlabel('t--->');ylabel('m(t)');

grid on; hold on;

subplot(5,1,4);plot(t,bpsk_sig(i,:));

tle('BPSK signal');xlabel('t--->');ylabel('s(t)');

grid on; hold on;

t1=t1+1.01; t2=t2+1.01;

end

hold off

%plot the input binary data and carrier signal

subplot(5,1,1);stem(m);

tle('binary data bits');xlabel('n--->');ylabel('b(n)');

grid on;

subplot(5,1,3);plot(t,c);

tle('carrier signal');xlabel('t--->');ylabel('c(t)');grid on;

% PSK Demodula on

t1=0;t2=Tb

for i=1:N

t=[t1:.01:t2]

%correlator

x=sum(c.*bpsk_sig(i,:));

%decision device

if x>0
demod(i)=1;

else

demod(i)=0;

end

t1=t1+1.01;

t2=t2+1.01;

end

%plot the demodulated data bits

subplot(5,1,5);stem(demod);

tle('demodulated data');xlabel('n--->');ylabel('b(n)');

grid on

Observation:-
Result:- Thus the PSK modula on and demodula on is verified and the
waveforms are plo ed.

You might also like