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

ANALOG AND DIGITAL

COMMUNICATION
LABORATORY

NAME: S.SAI SRINIVAS ADITHYA


22H51A04B7 II-YEAR ECE TR-2
SOFTWARE ADC LAB
1(A). AMPLITUDE MODULATION & DEMODULATION

AIM: To generate the Amplitude Modulation & Demodulation (under modulation, perfect
modulation & over modulation) using by MATLAB software.
EXPERIMENTAL REQUIREMENTS:
PC loaded with MATLAB
PROCEDURE:
1. Run MATLAB
2. Open a new script file
3. Write the code
4. Run the code for execution and obtain the necessary results
MATLAB Program:

clc;

close

all; clear

all;

disp('example: m=1 means 100% modulation');

m=input('Enter the value os modulation index (m)= ');

%m = 0.25;

%for for modulation

if(0>m || m>1)

error('m maybe less than or equal to one and greater than zero');

end

Am=5;

fa=2000;

Ta=1/fa;

t=0:Ta/999:6*Ta;
ym=Am*sin(2*pi*fa*t);

figure(1)

subplot(4,1,1);

plot(t,ym);

grid on;

title('Modulating Signal 04B7');

xlabel('time (sec)');

ylabel('Amplitude (volt)');

Ac=Am/m;

fc=fa*10;

Tc=1/fc;

yc=Ac*sin(2*pi*fc*t);

subplot(4,1,2);

plot(t,yc);

grid on

title('Carrier Signal 04B7');

xlabel('time (sec)');

ylabel('Amplitude (volt)');

%Equation of amplitude modulation

y=Ac*(1+m*sin(2*pi*fa*t)).*sin(2*pi*fc*t);

subplot(4,1,3);

plot(t,y);

title('Amplitude Modulated Signal 04B7');

xlabel('time (sec)');

ylabel('Amplitude (volt)');

grid on;
%AM demodulation

dem=y.*yc;

[b a] =

butter(1,0.001);

demf= filter(b,a,dem);

subplot(4,1,4);

plot(t,demf);

title('Demodulated signal 04B7');

xlabel('time(sec)');

ylabel('Amplitude(volt)');

grid on;

OUTPUT
1(B). Spectral analysis of AM signal

AIM: To analyze the spectrum of Amplitude Modulated signal using Matlab software.
EXPERIMENTAL REQUIREMENTS:
PC loaded with MATLAB
PROCEDURE:
1. Run MATLAB
2. Open a new script file
3. Write the code
4. Run the code for execution and obtain the necessary results
MATLAB Program:

clc;

close

all; clear

all;

disp('example: m=1 means 100% modulation');

m=input(' Enter the value of modulation index (m) = ');

if(0>m||m>1)

error('m may be less than or equal to one and geter than to zero');

end

Am=5;

fa=200;

Ta=1/fa;

fc=fa*10;

Tc=1/fc;

fs=5000;

T=1/fs;

L=1000;
t=(0:L-1)*T;

ym=Am*sin(2*pi*fa*t);

figure(1)

subplot(4,1,1);

plot(t,ym);

grid on;

title('Modulating Signal 4B7');

xlabel('time (sec)');

ylabel('Amplitude (volt)');

Ac=Am/m;

yc=Ac*sin(2*pi*fc*t);

subplot(4,1,2);

plot(t,yc);

grid on;

title('Carrier Signal 4B7');

xlabel('time (sec)');

ylabel('Amplitude (volt)');

y=Ac*(1+m*sin(2*pi*fa*t)).*sin(2*pi*fc*t);

subplot(4,1,3);

plot(t,y);

title('Amplitude Modulated signal 4B7');

xlabel('time (sec)');

ylabel('Amplitude (volt)');

grid on;

NFFT=2^nextpow2(L);

Y=abs(fft(y,NFFT)/L);
f=fs*linspace(0,1,NFFT);

subplot(4,1,4);

plot(f,Y);

xlim([1300,2600])

title('Spectrum of Amplitude Modulated signal 4B7');

xlabel('Frequency (Hz)');

ylabel('Amplitude (volt)');

OUTPUT:
2(A). FREQUENCY MODULATION & DEMODULATION

AIM: To generate frequency modulation & demodulation by using MATLAB software.

EXPERIMENTAL REQUIREMENTS:
PC loaded with MATLAB
PROCEDURE:
1. Run MATLAB
2. Open a new script file
3. Write the code
4. Run the code for execution and obtain the necessary results
MATLAB Program:

clc;

close

all; clear

all;

%fm=35HZ,fc=500HZ,Am=1V,Ac=1V,B=10

fs=10000;

Ac=1; Am=1;

fm=35; fc=500; B=10;

t=(0:.1*fs)/fs;

wc=2*pi*fc;

wm=2*pi*fm;

m_t=Am*cos(wm*t);

subplot(4,1,1);

plot(t,m_t);

xlabel('time (sec)');

ylabel('Amplitude (volt)');

title('Modulating or Message signal (fm=35Hz) 4B7');


c_t=Ac*cos(wc*t);

subplot(4,1,2);

plot(t,c_t);

xlabel('time (sec)');

ylabel('Amplitude (volt)');

title('Carrier signal (fm=500Hz) 4B7');

s_t=Ac*cos((wc*t)+B*sin(wm*t));

subplot(4,1,3);

plot(t,s_t);

xlabel('time (sec)');

ylabel('Amplitude (volt)');

title('Modulated signal 4B7');

d=demod(s_t,fc,fs,'fm');

subplot(4,1,4);

plot(t,d);

xlabel('time (sec)');

ylabel('Amplitude (volt)');

title('Demodulated Signal 4B7');


2(B). Spectral analysis of FM Signal

AIM: To analyze the spectral characteristics of the FM Signal.

EXPERIMENTAL REQUIREMENTS:
PC loaded with MATLAB
PROCEDURE:
1. Run MATLAB
2. Open a new script file
3. Write the code
4. Run the code for execution and obtain the necessary results
MATLAB Program:

close

all; clear

all; clc;

%fm=35HZ,fc=500HZ,Am=1V,Ac=1V,B=10

fs=10000;

Ac=1; Am=1;

fm=35; fc=500; B=10;

t=(0:.1*fs)/fs;

wc=2*pi*fc;

wm=2*pi*fm;

m_t=Am*cos(wm*t);

subplot(4,1,1);

plot(t,m_t);

xlabel('time(sec)');

ylabel('Amplitude (volt)');

title('Modulating or Message signal (fm=35Hz) 4B7');


c_t=Ac*cos(wc*t);

subplot(4,1,2);

plot(t,c_t);

xlabel('time (sec)');

ylabel('Amplitude(volt)');

title('Carrier signal(fm=500Hz) 4B7');

s_t=Ac*cos((wc*t)+B*sin(wm*t));

y=s_t;

subplot(4,1,3);

plot(t,s_t);

xlabel('time (sec)');

ylabel('Amplitude (volt)');

title('Modulated signal 4B7');

n=length(y);

Y=abs(fft(y));

f=(0:n-1)*(fs/n);

subplot(4,1,4);

plot(f,Y);

title('Spectrum of Frequency Modulated signal 4B7');

xlabel('Frequency (Hz)');

ylabel('Amplitude (volt)');
3.DSBSC MODULATOR & DETECTOR

AIM: To generate the DSBSC modulated and demodulated Signal using MATLAB software.

EXPERIMENTAL REQUIREMENTS:
PC loaded with MATLAB
PROCEDURE:
1. Run MATLAB
2. Open a new script file
3. Write the code
4. Run the code for execution and obtain the necessary results
MATLAB Program:

clc;

close

all; clear

all;

t=0:0.000001:0.001;

vm=1;

vc=1;

fm=2000;

fc=50000;

m_t=vm*sin(2*pi*fm*t);

subplot(4,1,1);

plot(t,m_t);

xlabel('time(sec)');

ylabel('Amplitud(volt)');

title('Message Signal 4B7');

c_t=vc*sin(2*pi*fc*t);

subplot(4,1,2);
plot(t,c_t);

xlabel('time(sec)');

ylabel('Amplitud(volt)');

title('Carrier Signal 4B7');

subplot(4,1,3);

s_t=m_t.*c_t;

hold on;

plot(t,s_t);

plot(t,m_t,'r:');

plot(t,-m_t,'r:');

xlabel('time (sec)');

ylabel('Amplitud (volt)');

title('Modulated Signal 4B7');

hold off;

r=s_t.*c_t;

[b a]=butter(1,0.01);

mr=filter(b,a,r);

subplot(4,1,4);

plot(t,mr);

xlabel('time (sec)');

ylabel('Amplitude (volt)');

title('Demodulated Signal 4B7');


4.SINGLE SIDE BAND SYSTEM

AIM: To generate SSB modulated and demodulated signal using Matlab software
EXPERIMENTAL REQUIREMENTS:
PC loaded with MATLAB
PROCEDURE:
1. Run MATLAB
2. Open a new script file
3. Write the code
4. Run the code for execution and obtain the necessary results
MATLAB Program:

clc;

close

all; clear

all;

t=0:0.001:2;

f1=3;

m1=sin(2*pi*f1*t);

m2=hilbert(m1);

subplot(4,1,1);

plot(t,m1);

xlabel('time');

ylabel('Amplitude');

title('Message Signal 4B7');

f2=60;

c1=sin(2*pi*f2*t);

c2= cos(2*pi*f2*t);

subplot(4,1,2);
plot(t,c1);

xlabel('time');

ylabel('Amplitude');

title('Carrier Signal 4B7');

s=0.5*m1.*c1-0.5*m2.*c2

; subplot(4,1,3);

plot(t,s);

xlabel('time');

ylabel('Amplitude');

title('Modulated Signal 4B7');

s1=s.*c1;

[b,a]=butter(1,0.001);

s2=filter(b,a,s1);

subplot(4,1,4);

plot(t,s2);

xlabel('time');

ylabel('Amplitude');

title('SSBSC Signal 4B7');


5. FREQUENCY DIVISION MULTIPLEXING AND DEMULTIPLEXING

AIM: To implement frequency division multiplexing and De- multiplexing using Matlab software.
EXPERIMENTAL REQUIREMENTS:
PC loaded with MATLAB
PROCEDURE:
1. Run MATLAB
2. Open a new script file
3. Write the code
4. Run the code for execution and obtain the necessary results
MATLAB Program:

clear all;

clc;

close

all;

t =0:0.000001:.001;

Vm= 1;

Vc= 1;

fm1 = 2000;

fc1 = 50000;

fm2 = 3000;

fc2 = 100000;

fm3 = 4000;

fc3 = 150000;

m_t1=Vm*sin(2*pi*fm1*t);

m_t2=Vm*sin(2*pi*fm2*t);

m_t3=Vm*sin(2*pi*fm3*t);
figure(1);

subplot(4,1,1);

plot(t,m_t1);

xlabel('time (sec)');

ylabel('Amplitude (volt) 4B7');

c_t1=Vc*sin(2*pi*fc1*t);

c_t2=Vc*sin(2*pi*fc2*t);

c_t3=Vc*sin(2*pi*fc3*t);

subplot(4,1,2);

plot(t,c_t1);

xlabel('time (sec)');

ylabel('Amplitude (volt) 4B7');

subplot(4,1,3);

s_t1=m_t1.*c_t1;

s_t2=m_t2.*c_t2;

s_t3=m_t3.*c_t3;

y=s_t1+s_t2+s_t3;

hold on;

plot(t,y);

% plot(t,m_t,'r:');

% plot(t,-m_t,'r:');

xlabel('time (sec)');

ylabel('Amplitude (volt) 4B7');

hold off;

r1=y.*c_t1;

[b a]=butter(1,0.0001);
mr1=filter(b,a,r1);

r2=y.*c_t2;

[b a]=butter(1,0.001);

mr2=filter(b,a,r2);

r3=y.*c_t3;

[b a]=butter(1,0.001);

mr3= filter(b,a,r3);

subplot(4,1,4);

plot(t,mr2);

xlabel('time (sec)');

ylabel('Amplitude (volt) 4B7');

You might also like