0% found this document useful (0 votes)
49 views28 pages

Poc Lab Manual Correct

POC VTU MANUAL BEC402

Uploaded by

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

Poc Lab Manual Correct

POC VTU MANUAL BEC402

Uploaded by

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

BANGALORE COLLEGE OF ENGINEERING AND TECHNOLOGY

CHANDAPURA, BANGALORE 560099

Department of Electronics and Communication Engineering

LAB MANUAL

PRINCIPLES OF COMMUNICATIONS SYSTEMS


BEC402

(2022 SCHEME)
LIST OF EXPERIMENTS

1. Basic Signals and Signal Graphing: a) unit Step, b) Rectangular, c) standard


triangle d) sinusoidal and e) Exponential signal.
2. Illustration of signal representation in time and frequency domains for a
rectangular pulse.
3. Amplitude Modulation and demodulation: Generation and display the relevant
signals and its spectrums.
4. Frequency Modulation and demodulation: Generation and display the relevant
signals and its spectrums.
5. Sampling and reconstruction of low pass signals. Display the signals and its
spectrum.
6. Time Division Multiplexing and demultiplexing.
7. PCM Illustration: Sampling, Quantization and Encoding
8. Generate a) NRZ, RZ and Raised cosine pulse, b) Generate and plot eye diagram
9. Generate the Probability density function of Gaussian distribution function.
10. Display the signal and its spectrum of an audio signal.
Ex.No:1
Basic Signals and Signal Graphing: a) unit Step, b) Rectangular, c) standard
triangle d) sinusoidal and e) Exponential signal.
a) unit Step signal

clc ;
clf ;
clear all;
L =5;
n=-L:L;
x=[ zeros(1,L),ones(1,L +1)];
a= gca();
a.y_location ="middle";
plot2d3 (n,x)
title ( "unitstep" );
xlabel ( "n" );
ylabel ( "x" );

b) Rectangular
clc;
clear ;
x=-4:0.0001:4;
y=((sign(x)+1)/2-((sign(x-2)+1)/2));
plot(x,y)
title("rectangular signal");
xlabel("t");
ylabel("p(t)");
axis([ -4 4 -3 3]);
c) standard triangle
clc ;
clf ;
clear all;
// Capt ion : g e n e r a t i o n o f t r i a n g u l a r wave
a =8;
t =0:( %pi /4) :(4* %pi);
y=a*sin(2*t);
a= gca();
a.x_location ="middle";
plot (t,y)
title ( " t r i a n g u l a r wave " );
xlabel ( " t " );
ylabel ( " y " );
d)sinusoidal
clc ;
clf ;
clear all;
// Caption : g e n e r a t i o n o f s i n e wave
f =0.2;
t =0:0.1:10;
x= sin(2*%pi*t*f);
plot (t,x);
title ( "sinewave" );
xlabel ( "t" );
ylabel ( "x" );

e) Exponential signal
clc ;
clf ;
clear all;
// Capt ion : g e n e r a t i o n o f e x p o n e n t i a l wave
t = -2:0.1:2;
x= exp (t);
plot (t,x)
title ( " e x p o n e n t i a l wave " );
xlabel ( " t " );
ylabel ( " x " );
EX:NO:2

2. Illustration of signal representation in time and frequency domains for a


rectangular pulse.

clc ;
close ;
// DTS S i g n a l
N1 = 2;
n = - N1 : N1 ;
x = ones (1 , length (n ) ) ;
// D i s c r e t e −tim e F o u r i e r T ran sfo rm
Wmax = 2* %pi ;
K = 4;
k = 0:( K /1000) : K ;
W = k * Wmax / K ;
XW = x*exp(- sqrt(-1)*n'* W ) ;
XW_Mag = real ( XW ) ;
W = [ - mtlb_fliplr (W ) , W (2:1001) ]; // Omega f rom −
Wmax to Wmax
XW_Mag = [ mtlb_fliplr ( XW_Mag ) , XW_Mag (2:1001) ];
// p l o t f o r ab s ( a )<1
figure
subplot (2 ,1 ,1) ;
a = gca () ;
a.y_location ='origin';
a.x_location ='origin';
plot2d3 ( 'gnn',n,x);
xtitle("Discrete Time Sequencex[n]");
subplot (2 ,1 ,2) ;
a = gca () ;
a.y_location =" o r i g i n ";
a.x_location =" o r i g i n ";
plot2d (W , XW_Mag )
title ( "D i s c r e t e Time F o u r i e r T ran sfo rm X( exp (jW ) )" )
EX:NO:3
Amplitude Modulation and demodulation: Generation and display the
relevant signals and its spectrums.
clc;
clear;
close;
fm=3;
fc=20;
fs=100
t=0:1/fs :3;
p=length(t)
am=input('Enter the message signal amplitude =');
ac=input('Enter the carrier signal amplitude (ac>am)=');
//Message signal generation
msg=am*cos(2*%pi*fm*t);
figure(1);
subplot(3,1,1);
plot(t,msg);
xlabel('TIME');
ylabel('AMPLITUDE')
title('Message Signal');
//Carrier signal generation
carrier=ac*cos(2*%pi*fc*t);
subplot(3,1,2);
plot(t,carrier);
xlabel('TIME');
ylabel('AMPLITUDE')
title('Carrier Signal');
ka=1/ac;
u=ka*am;
disp(u,'Modulation Index =')
//Modulation generation
am_mod=(1+ka.*msg).*carrier;
subplot(3,1,3);
plot(t,am_mod);
xlabel('TIME');
ylabel('AMPLITUDE')
title('Amplitude Modulated Signal');
// Frequency spectrum
d=(-p/2:1:p/2-1)*1/3;
figure(2);
subplot(3,1,1);
plot(d,abs(fftshift(fft(am_mod))));
xlabel('FREQUENCY');
ylabel('AMPLITUDE')
title('AM Signal Spectrum');

//Demodulation of DSBSC Signal


demod=am_mod.*carrier;
k=abs(fft(demod));
filt=[ones(1,4*fm),zeros(1,p-4*fm)];
out=k.*filt;
subplot(3,1,3);
plot(t,ifft(out));
xlabel('TIME');
ylabel('AMPLITUDE')
title('Demodulated message');

Enter the message signal amplitude =5

Enter the carrier signal amplitude (ac>am)=10

Modulation Index = 0.5


EX.NO:4
Frequency Modulation and demodulation: Generation and display the
relevant signals and its spectrums.
clc;
clear;
close;
fs=300
t=0:1/fs :2;
p=length(t)
fm=input('Enter the message signal frequency=');
fc=input('Enter the carrier signal frequency(fc>>>fm) =');
am=input('Enter the message signal amplitude =');
ac=input('Enter the carrier signal amplitude (ac>am)=');
//Message signal generation
msg=am*cos(2*%pi*fm*t);
figure(1);
subplot(3,1,1);
plot(t,msg);
xlabel('TIME');
ylabel('AMPLITUDE')
title('Message Signal');
//Carrier signal generation
carrier=ac*cos(2*%pi*fc*t);
subplot(3,1,2);
plot(t,carrier);
xlabel('TIME');
ylabel('AMPLITUDE')
title('Carrier Signal');
//Freq mod
kf=4;
mod_index=(kf*am)/fm;
disp(mod_index,'The Modulation Index =');
fm_mod=ac*cos((2*%pi*fc*t)+(mod_index.*sin(2*%pi*fm*t)));
subplot(3,1,3);
plot(t,fm_mod);
xlabel('TIME');
ylabel('AMPLITUDE')
title('Frequency Modulated Signal');
// Frequency spectrum
d=(-p/2:1:p/2-1)*1/3;
figure(2);
subplot(3,1,1);
plot(d,abs(fftshift(fft(fm_mod))));
xlabel('FREQUENCY');
ylabel('AMPLITUDE')
title('FM Signal Spectrum');

//Demodulation
demod=fm_mod.*carrier;
k=abs(fft(demod));
filt=[ones(1,4*fm),zeros(1,p-4*fm)];
out=k.*filt;
subplot(3,1,3);
plot(t,ifft(out));
xlabel('TIME');
ylabel('AMPLITUDE')
title('Demodulated message');

Enter the message signal frequency=5


Enter the carrier signal frequency(fc>>>fm) =10
Enter the message signal amplitude =4
Enter the carrier signal amplitude (ac>am)=8
The Modulation Index = 3.2
EX.NO:5
Sampling and reconstruction of low pass signals. Display the signals and its
spectrum
clc;
close;
clear;
fm=input('Enter the input signal frequency=');
k=input('Enter the number of Cycles of input signal =');
A=input('Enter the input signal amplitude =');
tm=0:1/(fm*fm):k/fm;
x=A*cos(2*%pi*fm*tm);
figure(1);
a=gca();
a.x_location="origin";
a.y_location="origin";
plot(tm,x);
xlabel('TIME');
ylabel('AMPLITUDE')
title('Original Signal');
xgrid(1)
//Sampling Rate
fnyq=2*fm;
//UNDER Sampling
fs=(3/4)*fnyq;
n=0:1/fs:k/fm;
xn=A*cos(2*%pi*fm*n);
figure(2);
a=gca();
a.x_location="origin";
a.y_location="origin";
plot2d3('gnn',n,xn);
plot(n,xn,'r');
xlabel('TIME');
ylabel('AMPLITUDE')
title('UNDER Sampling');
legend('Sampled Signal','Reconstructed Signal');
xgrid(1)
//NYQUIST SAMPLING
fs=fnyq;
n=0:1/fs:k/fm;
xn=A*cos(2*%pi*fm*n);
figure(3);
a=gca();
a.x_location="origin";
a.y_location="origin";
plot2d3('gnn',n,xn);
plot(n,xn,'r')
xlabel('TIME');
ylabel('AMPLITUDE')
title('NYQUIST SAMPLING');
legend('Sampled Signal','Reconstructed Signal');
xgrid(1)
//OVER SAMPLING
fs=fnyq*10;
n=0:1/fs:k/fm;
xn=A*cos(2*%pi*fm*n);
figure(4);
a=gca();
a.x_location="origin";
a.y_location="origin";
plot2d3('gnn',n,xn);
plot(n,xn,'r');
xlabel('TIME');
ylabel('AMPLITUDE')
title('OVER SAMPLING');
legend('Sampled Signal','Reconstructed Signal');
xgrid(1)
Enter the input signal frequency=5
Enter the number of Cycles of input signal =8
Enter the input signal amplitude =5
EX.NO:6
Time Division Multiplexing and demultiplexing.
clc ;
close ;
clear
fs =100
t =0:1/ fs :1;
//GENERATION OF 3 MESSAGE SIGNALS FOR MULTIPLEXING
//Mes sage S i g n a l 1
message_1 = 2* sin (2* %pi *3* t); // Sine s i g n a l o f f r e q u e n c y 3 hz
figure (1)
subplot (3 ,1 ,1)
plot2d3 (t, message_1 )
xlabel("TIME")
ylabel ("AMPLITUDE")
title ("MESSAGE SIGNAL 1( SINE WAVE)");
//Mes sage S i g n a l
message_2 = 1* squarewave (2* %pi *3* t); // Squarewave s i g n a l o f f r e q u e
n c y 3 hz
subplot (3 ,1 ,2)
plot2d3 (t, message_2 )
xlabel("TIME");
ylabel( "AMPLITUDE ")
title ( "MESSAGE SIGNAL 2(SQUAREWAVE) " );
//Mes sage S i g n a l 3
message_3 = 3* cos (2* %pi *3* t) // Co s ine s i g n a l o f f r e q u e n c y 3 hz
subplot (3 ,1 ,3)
plot2d3 (t, message_3 )
xlabel ("TIME ")
ylabel ( "AMPLITUDE" )
title ( "MESSAGE SIGNAL 3(COSINE WAVE)" );
// GENERATIONN OF TIME DIVISION MULTIPLEXED SIGNAL
tdm =0;
j=1
for i =1:3:3* length (t)
tdm (i)= message_1 (j);
i=i+1;
tdm (i)= message_2 (j);
i=i+1;
tdm (i)= message_3 (j);
j=j+1
end
figure (2)
subplot (2 ,1 ,1)
plot2d3 (tdm)
xlabel ( "TIME " );
ylabel ( "AMPLITUDE " )
title ( "TIME DIVISION MULTIPLEXED SIGNAL " );
// DEMULTIPLEXING OF TDM SIGNAL
n=1
for k =1:1: length (t)
m3(k)= tdm (n)
n=n+1;
m4(k)= tdm (n)
n=n+1;
m5(k)= tdm (n)
n=n+1;
end
figure (3)
subplot (3 ,1 ,1)
plot2d3 (m3)
xlabel ("TIME")
ylabel ("AMPLITUDE")
title ( "DEMUX MESSAGE SIGNAL 1( SINE WAVE)" );
subplot (3 ,1 ,2)
plot2d3 (m4)
xlabel ( "TIME " );
ylabel ( "AMPLITUDE " )
title ( "DEMUX MESSAGE SIGNAL 2(SQUAREWAVE) " );
subplot (3 ,1 ,3)
plot2d3 (m5)
xlabel ("TIME " );
ylabel ( "AMPLITUDE " )
title ( "DEMUX MESSAGE SIGNAL 3(COSINE WAVE) " );
EX.NO:7
PCM Illustration: Sampling, Quantization and Encoding
clc ;
close ;
clear ;
f =2;
fs =20* f; // Sampl ing Fr equency
t =0:1/ fs :2;
a =2;
msg =a*sin (2.* %pi *f*t);
subplot (3 ,1 ,1);
plot (t,msg)
xlabel ( "TIME " );
ylabel ( "AMPLITUDE " )
title ( "Mes sage S i g n a l " );
x1=msg+a; // Le v e l S h i f t i n g to o n e s i d e d s i g n a l
disp (x1 , " Di s c r e t e Sampled Value s o f Message Sign a l " )
// Di s p l a y s sampled v a l u e s
quant = round (x1); // Qu a n t i z a t i o n
disp (quant , " Quant i z ed Sampled Value s "); // Di s p l a y s q u a n t i z e d v a
lues
enco = dec2bin ( quant ); // Encoding i n t o b i n a r y data
deco = bin2dec ( enco ); // Re c o v e r ing Analog Mes sage s i g n a l
recover =deco -a;
subplot (3 ,1 ,2);
plot (t, recover )
xlabel ( "TIME ");
ylabel ( "AMPLITUDE" )
title (" Re cove r ed S i g n a l" );
h= gca ();
h. data_bounds =[0 , -3;2 ,3]
subplot (3 ,1 ,3);
plot (t,msg ,t, recover , " r " )
xlabel ("TIME " );
ylabel ("AMPLITUDE" )
title ( " Re cove r ed VS Or i g i n a l S i g n a l " );
h= gca ();
h. data_bounds =[0 , -3;2 ,3]
EX.NO.8
Generate a) NRZ, RZ and Raised cosine pulse, b) Generate and plot eye
diagram.
clc;
closeall;
clearall;
%Generate 400 random bits
data = sign(randn(1,400));
%Define the symbol period
T = 64;
Td = 32;
%Generate impulse train
dataup=upsample(data, T);
%Return to zero polar signal
yrz=conv(dataup,[zeros(1,T/4) ones(1,T/2) zeros(1,T/4)]);
yrz=yrz(1:end-T+1);
%Non-return to zero polar signal
ynrz=conv(dataup, ones(1,T));
ynrz=ynrz(1:end-T+1);
% generating RC pulse train and rolloff factor = 0.5
yrcos=conv(dataup, rcosfir(0.5, Td, T,1,'normal'));
yrcos=yrcos(2*Td*T:end-2*Td*T+1);
eye1=eyediagram(yrz,T,T,T/2);
title('RZ eye-diagram');
grid('on');
ylim([-1.5,1.5]);
xlim([-Td-2,Td+2])
eye2=eyediagram(ynrz,T,T,T/2);
title('NRZ eye-diagram');
grid('on');
ylim([-1.5,1.5]);
xlim([-Td-2,Td+2])
eye3=eyediagram(ysine,T,T,T/2);
title('Half-sine eye-diagram');
grid('on');
ylim([-1.5,1.5]);
xlim([-Td-2,Td+2])
eye4=eyediagram(yrcos,2*T,T);
title('Raised-cosine eye-diagram');
grid('on');
ylim([-1.5,1.5]);
xlim([-Td-2,Td+2])
);
Ex.no:9
Generate the Probability density function of Gaussian distribution function.
/ Define parameters
mu = 0; // Mean
sigma = 1; // Standard deviation
// Define range for x values
x = linspace(-5, 5, 1000); // Range from -5 to 5 with 1000 points
// Calculate PDF using Gaussian distribution formula
pdf = 1/(sqrt(2*%pi)*sigma) * exp(-0.5 * ((x - mu)/sigma).^2);
// Plot PDF
plot(x, pdf);
title('Probability Density Function of Gaussian Distribution');
xlabel('x');
ylabel('PDF');

EX.NO:10 Display the signal and its spectrum of an audio signal.


wavread("SCI/modules/sound/demos/chimes.wav","size")
[y,Fs,bits]=wavread("SCI/modules/sound/demos/chimes.wav");Fs,bits
subplot(2,1,1)
plot2d(y(1,:)) // first channel
subplot(2,1,2)
plot2d(y(2,:)) // second channel
y=wavread("SCI/modules/sound/demos/chimes.wav",[1 5]) //the first five samples

You might also like