EXNO: 10(a)
BLOCK CODE GENERATION
MATLAB PROGRAM:
clc; clear; w=[1 0 0 0 1 0]; fprintf(The original code is:); disp(w); P=[1 1 0; 0 1 1; 0 0 1]; I=[1 0 0; 0 1 0; 0 0 1]; pt=P`; H=[pt,I]; ht=H; disp(ht); for(i=1:3) s1=0; for(j=1:6) s1xor(s1,ht(j,i)*w(j)); end s(i)=s1; end fprint(The syndrome is:); disp(s); for(k=1:6); if(s==ht(k,:)) temp=k;
end end fprintf(The error is in the position %d\n,temp); w(temp)=xnor(w(temp),1); disp(Corrected code is:); disp(w)
OUTPUT The original code is: 1 1 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 0 0 0 0 0 1 0
The syndrome is:
The error is in the position 4 Corrected code is: 1 0 0 1 1 0
EXNO: 10(b) MATLAB PROGRAM:
ASK, FSK, PSK GENERATION
AMPLITUDE SHIFT KEYING
clc; fc=5; fd=5; fs=50; m=4; x=[ones(3,1);zeros(3,1);ones(3,1)]; [y,t]=dmod(x,fc,fd,fs,ask,m); plot(t,y,k); ylabel(AMPLITUDE--->); xlabel(TIME--->); title(AMPLITUDE SHIFT KEYING);
FREQUENCY SHIFT KEYING
clc; fc=5; fsi=5; fso=100; m=2; x=[ones(3,1);zeros(2,1);ones(2,1)]; [y,t]=dmod(x,fc,fsi,fso,fsk,m); plot(t,y,k);
ylabel(AMPLITUDE--->); xlabel(TIME--->); title(FREQUENCY SHIFT KEYING);
PHASE SHFIT KEYING
clc; fm=21; fa=20; fb=400; m=2; x=[ones(1,3);zeros(1,5);ones(1,2)]; [y,t]=dmod(x,fm,fa,fb,psk,m); plot(t,y,k); ylabel(AMPLITUDE--->); xlabel(TIME--->); title(PHASE SHIFT KEYING);
EXNO:10(c) PROPERTIES MATLAB PROGRAM:
clc; clear;
PN SEQUENCE GENERATION AND ITS
x=input(Enter the Number of Registers:); len=(2^x)-1; fprintf(\nInital state of the Registers:); for i=1:x if(i==1) r(i)=1; else r(i)=0; end fprintf(\t%d,r(i)); end
%Balance property% ones=0; zeros=0; for i=1:len if(p(i)==1) ones=ones+1; else zeros=zeros+1;
end end if(ones>zeros) fprintf(\n\nBalance property is satisfied\n); else fprintf(\n\nBalance property is not satisfied\n); end
%run length property% Run=0; for j=1(len-1) if(p(j)~=p(j+1)) run=run+1; end end frprintf(\n no of runs=%d\n,run); if(run==(2^(x-1))) fprintf(\nRun length property is satisfied); else fprintf(\nRun length property is not satisfied); end
%Autocorrelation property% temp=p(len); fprintf(\n\nPN Sequence after shifting:);
output=p; for j=len:-1:2 output(j)=output(j-1); end output(1)=temp; fprintf(\t%d,output); agree=0; disagree=0; for j=1:len if(output(j)==p(j)) agree=agree+1; else disagree=disagree+1; end end if(disagree>agree) fprintf(\n\nAuto correlation property is satisfied\n); else fprintf(\n\nAuto correlation property is not satisfied\n); end
output 1 Enter the Number of Registers:3 Initial state of the Registers: 1 PN Sequence : 0 0 1 1 1 0 1 0 0
Balance property is statisfied No of runs=3 Runs length property is not satisfied PN Sequence after shifting: 1 0 0 1 1 1 0
Auto correlation property is satisfied
Output 2 Enter the Number of Registers:4 Initial state of the Registers: 1 PN Sequence :0 0 0 1 0 1 1 0 1 0 0 1 0 1 1 0 0 1
Balance property is satisfied No of runs=7 Runs length property is not satisfied PN Sequence after shifting:1 0 0 1 0 1 1 0 0 0 1 0 1 1 1
Auto correlation property is satisfied