Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

B M S COLLEGE OF ENGINEERING

(Autonomous College under VTU)


Bull Temple Road, Basavanagudi, Bangalore - 560019

An Assignment submitted in partial fulfillment of the AAT


for Semester V

In
Advanced Communication Lab
(22EC5PCACL)

By
YATHISH C S
(1BM21EC216)

Under the guidance of


Dr. MADHUSUDHAN K N
Assistant professor
Department of Electronics and Communication
1. Demonstrate sampling, quantization and reconstruction of any signal

close: all,
clear.».11,’

f-50;
Ü-0:1/100/f:l/f,
x=sîn{2*pi*f*f},

x1abeI ( t”! ”) ;
ylabe”1 (.' x”(t)””'

m=5B;.% No. oC Samp}es

subp1öt( 312).;
stem((B.ni„xs);
t1tIe( S”änp1ed S1g”na”l x [r ï] ”' )
xta ”bè”ï ( ' ri ' ) ;
yläKeI(’x[n]’)ç
Demonstrate digital communication system
1. BASK

File Edit Insert Tools Desktop Window Help


2. BFSK:
2. Demonstrate BER performance of digital commuication system employing bpsk
modulation scheme with a convolution

Y Lam = v*aii ba î{’B; ’Ă iea ue ’Vlait. ..... ’ }.j


e -. ’for coqnt=i•iengtn¿swg

maltbac((((conrt-a)’mam nur› con_time-a)/(ie‹n th(smRaB)’rmax m‹um))j

’O’.a% a ’!(" n’m_b " '

" n I

• "I
I ț
3. Demonstrate PCM
2 clc
2 close ’all
3 clear pll
4 t = B:0.B0B1:20;
5 c=input('€nter Bit Depth Df PCF Coding: "};
6 part = -1:B.l:1;
7 codeBsok = -l:B.1:l.lj

9 [ ,quañts] - 9u°"tiz(m sg,part,codpBook);


l0’ subplot(3,1,1);
11 plot(t,msg};
12. tifIe('lesspgz ’Signal');
13 subplot(3,1,2);
14 Pl°t(t,9ua"t•);
15 title(’Quantized Signai');
lb y = uencode(quants,c);
17 yBin=dec2bin(y,c); %converting. it to final binary form to make
l8 subplot(3,i,3};
19. plot(t,y);
20 title('PA/4 PLO?”};

#temsage£|gnat

8 Ié 12 14 48 20

Ouenlized '9 ig nal

10 d2 J6 20

10 12 14 10 20
4. Demonstrate huffman coding and shannon fano coding
HUFFMAN CODING

end

while length(set_EoRtents) › 1

[temp, sorted_Ind*ces]' sort( etyrobabiiities);

zero_probabiliiy = set_probabvlities(sorted_indices(1));

35

d is p {'[ n um 2s t r (in d ex )-,

% ’CalcJlate ’the symbol entropy

49
% Caltulate ihë avèra Be Muf{man codèword. ’len8.th’
av_Zength = 8;
for index’ = Ï:length(codewords)
”53 av_length = av length + proAabilitiev(index)"length(codewords(index});
5% end
55
56 d*sp(['’The ’symbol entropy Ïs: ’,num2ttF(qnfropyjj)
57 disp( [ ’ Th e a*:re r.a@ê Hufffii a Èi « ad emÖ rd I e ngtfi i s : ,’ Èium2 str (.afi l”e n h)] )
SB disp(["’The ë?ficienc): is: ',num2str(ehtropy/av_iength)])
59

’,io oi, ’,io i]i ’,[o i oj, ’,ii i oj, ’,to i ii, ;ii i ict

z o.zs ’i ö

s o.i i i o

: ü.
SHANNON CODING

clc;
2 clear q} ;
close all;
N=input( ' enter no of symkols = ');
P1=input(’enter probabilities of each symbols = ');
P=sort(P1,'de’scend');
su]=sum(P);
aq=num2str(sul); Bto convprt tp string so that while converting back to num
s u 2 =str2d nub le( aq) , $ be mill get integer .
IØ ref (su 2 =l) $t o che ck- whet her suit Of a11 the p sob ab i lity is one
h=in sgbox ( ' In rn or p co h abi lit y shou Id he one ' , ' z r r or '> ’ e r ror ’ ) ;

Æ3 else
disp(’total probability sum 1s one’};
15 end
16 [rl, cl]=size(P); %to ’find total no of probabilities given
17 %pause(5);
if(N-=c*)
19. h-msgbox('proBabi’lity dimension is dot matching with given n’o of Eymbols’,
2s
21 end
22 % following declaration in ord<r to Ullocate memory and increase speed of
:2 3 $ c al cu latio n
24 rir= z ecns.(, l N) j Sto calcu late 1+log2( l /P (1)
2S m1=zeroi(l,N); % to calculate log2(1/P(i)
26 H=0,
2T resultl=zeros(1,N); %to get code word
28 f=zeros(],N); B to fiñd cumulative probability
J9 g=zeros(2,N); %variable to store binary conversion of integer
)0 |k=zeros(],B); %to retain only ’0' or '*'
N_bar=0; %to calculate average code length
52 Cor i=I:N
33 H=H+P(i)’log2(1/(P(i))); % entropy of sourte

35 m ( i ) =1+1og2 (1/ P( i.) ) ;X find ende len gth


36 æl(ij=log2(l/P(i)); % code length
37 teæp=e1(i)-fix(m1(i));% case where lntegez appear in m
38 if(temp==B)

end
41 riix(m(i));%to get integer value
82 N_bar=N_bar+r*P( 1) ; Sto din d ave ”ra ge code Length
43 if(i==1)
44 f(i)=0;%cumulative for first
45 else
5. DEMONSTRATE DSSS AND FHSS

DSSS

rlc, cleam all, .close alI;


Dat a - [ 1 6 1. @ -. B :1 B ”1 1, I- .0 -..0 } ”j /%'1-s s ag S e qtJ e nc e .
Da n-a =r e c t pu 1s e( Dat a , -1'); ””
G= 1 e ngt h ( Da”6-a.} ;

’Ôl -’[] 1 I ’*j, %ÎnÏ’tïal CÔndition’ ]Fg+’’’’’?lip f’lÔp.

’for j=%:O Lsngth D’f Pd SeguenCe


.s f?N =[PM1’sd1(4}},
’iÎ sdL(Ÿ)-=üÖI(3)

12’

s d1 (4 --------temp1;

is d=lëngth(PN1);

sp=d’ouble( sp) ,%con.vert ïng the iogica’l i•alue to double va’lue.


% comp_sïg=zp,
25"’
26. KóMp i g=àWgn/pp,5nD),
;cOmó :i€}c°m ’#18( : ü<B) ,
2B.

p’1’ot(Pf4t.);
titlr('çN.üèqoenc=')r
subplot(2,2’)3’);
FHSS

carrierl=cos(timel);

«érrek2-[carriers qarfier2 catrier2:iariier2 tarrier3 <arrier2];


ñarrierZeCoz[ji‹s );
sg catrier3=[carrler3 §ârrier5 c$wrleñ3 carridr8j;

.arrier5-cos(tine5};
54 careers=[terriers cqrrier5]j

sa
n=l:?0
se.' c=randi({i 6],i,i); B& Onequeucies ace nandosly are.selected by.tHe Pw generator

6 5

W Il=DsPreeO_s'8"a1 '°rri°r6):

#1 ((l:MO8] sprgad signpl};


76 pis({-i 74gB i.5 J.sj]
iitle('l6f\ii.Sprgbd 5igqal.wifh 6 (regu#ncips'j;

.8 i 'Z”s Lading BPs< signal


fmq_lioppedysig=bpstc_nod signal .*spread_s2ynal ;, XTh'i s is I he £ igina l who c h is be ing l-i na II a'y tr ansnit ted

axig - . - . .. ;
title('\bf\it frequAncy Nop#ed Spread Spectrum $iyvl’))

You might also like