Adc Lab Matlab
Adc Lab Matlab
DIGITAL
COMMUNICATION USING
MATLAB
Dept of ECE,MITS
Program:
clc;
close all;
clear all;
% Signal generation
x=0:.5:4*pi;
sig1=8*sin(x);
l=length(sig1);
sig2=8*triang(l);
Dept of ECE,MITS
Dept of ECE,MITS
Dept of ECE,MITS
model waveforms:
Result:
Dept of ECE,MITS
Program:
clc;
close all;
clear all;
a=1;
f=2;
t=0:0.01:1;
x=a*sin(2*pi*f*t)+a;
figure(1)
plot(t,x);
figure(2)
stem(t,x);
part=[0:0.1:2*a];
code=[0:0.1:((2*a)+0.1)]
[ind,d]=quantiz(x,part,code);
figure(3)
stairs(t,d)
pcm=dec2bin(d);
display(pcm);
Dept of ECE,MITS
model waveforms:
Result:
Dept of ECE,MITS
Program:
clc;
clear all;
close all;
a=2;
t=0:2*pi/50:2*pi;
x=a*sin(t);
l=length(x);
plot(x,'r');
delta=0.2;
hold on
xn=0;
for i=1:l;
if x(i)>xn(i)
d(i)=1;
Dept of ECE,MITS
Dept of ECE,MITS
Result:
Dept of ECE,MITS
Algorithm:
FSK modulation
Generate two carriers signal.
1. Generate binary data, message signal and inverted message signal
2. Start FOR loop
3. Multiply carrier 1 with message signal and carrier 2 with inverted message signal
4. Perform addition to get the FSK modulated signal
5. Plot message signal and FSK modulated signal.
6. End FOR loop.
7. Plot the binary data and carriers.
FSK demodulation
1. Start FOR loop
2. Perform correlation of FSK modulated signal with carrier 1 and carrier 2 to get two decision
variables x1 and x2.
Dept of ECE,MITS
Dept of ECE,MITS
Dept of ECE,MITS
Result:
Dept of ECE,MITS
transmiter
Reciver
Dept of ECE,MITS
QPSK demodulation
1. Start FOR loop
2. Perform correlation of QPSK modulated signal with quadrature carriers to get two decision
variables x1 and x2.
3. Make decision on x1 and x2 and multiplex to get demodulated binary data.
If x1>0and x2>0, choose 11. If x1>0and x2<0, choose 10. If x1<0and x2>0, choose
01. If x1<0and x2<0, choose 00.
End FOR loop
4.Plot demodulated data
Program:
clc;
clear all;
close all;
%GENERATE QUADRATURE CARRIER SIGNAL
Tb=1;t=0:(Tb/100):Tb;fc=1;
%for 90 degrees phase shift as same as just change sin function pi,2pi/3,2pi in c1
c1=sqrt(2/Tb)*sin(pi/2+2*pi*fc*t);
c2=sqrt(2/Tb)*sin(2*pi*fc*t);
Dept of ECE,MITS
Result:
Dept of ECE,MITS
PROGRAM:
clc;
clear all;
close all;
m=1;n=8;
b=randint(m,n);
figure(1)
stairs(b);
k=1;
for i=1:n-1;
f(1)=xor(k,B(1,1));
f(i+1)=xor(not(f(i),b(1,i+1));
end
if f(i)>0
m(i)=0
else
m(i)=1;
Dept of ECE,MITS
Result:
Dept of ECE,MITS