Professional Documents
Culture Documents
Adc Sai
Adc Sai
COMMUNICATION
LABORATORY
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;
%m = 0.25;
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;
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
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);
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);
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;
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;
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;
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);
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])
xlabel('Frequency (Hz)');
ylabel('Amplitude (volt)');
OUTPUT:
2(A). FREQUENCY MODULATION & DEMODULATION
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;
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)');
subplot(4,1,2);
plot(t,c_t);
xlabel('time (sec)');
ylabel('Amplitude (volt)');
s_t=Ac*cos((wc*t)+B*sin(wm*t));
subplot(4,1,3);
plot(t,s_t);
xlabel('time (sec)');
ylabel('Amplitude (volt)');
d=demod(s_t,fc,fs,'fm');
subplot(4,1,4);
plot(t,d);
xlabel('time (sec)');
ylabel('Amplitude (volt)');
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;
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)');
subplot(4,1,2);
plot(t,c_t);
xlabel('time (sec)');
ylabel('Amplitude(volt)');
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)');
n=length(y);
Y=abs(fft(y));
f=(0:n-1)*(fs/n);
subplot(4,1,4);
plot(f,Y);
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)');
c_t=vc*sin(2*pi*fc*t);
subplot(4,1,2);
plot(t,c_t);
xlabel('time(sec)');
ylabel('Amplitud(volt)');
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)');
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)');
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');
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');
s=0.5*m1.*c1-0.5*m2.*c2
; subplot(4,1,3);
plot(t,s);
xlabel('time');
ylabel('Amplitude');
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');
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)');
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)');
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)');
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)');