You are on page 1of 9

AC LAB EXPERIMENTS

PAGE NUMBERS

1. AMPLITUDE MODULATION………………………………………………………………….

2. AMPLITUDE DEMODULATION……………………………………………………………

3. DIODE DETECTOR………………………………………………………………………………

4. DOUBLE SIDE BAND MODULATION…………………………………………………….

5. DOUBLE SIDE BAND DEMODULATION…………………………………………………

6. BALANCE MODULATION………………………………………………………………………..

7. SINGLE SIDE BAND MODULATION………………………………………………………

8. SINGLE SIDE BAND DEMODULATION……………………………………………………..

9. AMPLITUDE SPECTRUM………………………………………………………………………….

10. FREQUENCY SPECTRUM…………………………………………………………………………….

11. SINGLE SIDE SPECTRUM………………………………………………………………………………

12. DOUBLE SIDE BAND SPECTRUM…………………………………………………………………


disp('AMPLITUDE MODULATION')

ac=input('enter the value of ac')

if isempty(ac)

ac=1;

end

disp(sprintf('ac=%d',ac));

am=input('enter the value of am');

if isempty(am)

am=1

end

disp(sprintf('am=%d',am));

fc=100;

fm=10;

m=input('enter the value of m');

if isempty(m)

m=1;

end

n=input('enter the value of n');

if isempty(n)

n=0.5;

end

o=input('enter the value of o');

if isempty(o)

o=1.5;

end
fs=8*fc

time=0.5

t=0:(1/fs):time

carr=ac*cos(2*pi*fc*t);

msg=am*cos(2*pi*fm*t);

mod=(1+m*cos(2*pi*fm*t)).*carr;

unmod=(1+n*cos(2*pi*fm*t)).*carr;

ovmod=(1+o*cos(2*pi*fm*t)).*carr;

subplot(5,1,1);plot(t,msg);

title('message signal');

subplot(5,1,2);plot(t,carr);

title('carrier signal');

subplot(5,1,3);plot(t,mod);

title('100% modulation');

subplot(5,1,4);plot(t,unmod);

title('under modulation');

subplot(5,1,5);plot(t,ovmod);

title('over modulation');

disp('AMPLITUDE MODULATION AND DEMODULATION');

ac=input('enter the amplitude of carriere wave form');

if isempty( ac )

ac= 1;

end

disp(sprintf('ac=%d',ac));
fc=input('enter the frequency of carrier waveform');

if isempty(fc)

fc=100;

end

disp(sprintf('fc=%d',fc));

Am=input('enter the amplitude of the message waveform');

if isempty(am)

am=1;

end

disp(sprintf('am=%d',am));

fm=input('enter the frequency of the message signal');

if isempty(fm)

fm=10;

end

disp(sprintf('fm=%d',fm));

modnindex=input('enter the modulation index');

if isempty(modnindex)

modnindex=0.5;

end

disp(sprintf('modnindex=%f',modnindex));

timeindex=input('enter then time duration for which simulation needs to be sum (sec):');

if isempty(timeindex)

timeindex=0.5;

end

disp(sprintf('timeindx=%f', timeindex));

fs=8*fc;
t=0:(1/fs):timeindex;

carrwave=ac*sin(2*pi*fc*t);

messwave=am*sin(2*pi*fm*t);

disp('performing amplitude modulation');

AM_mod=(1+modnindex*messwave).*carrwave;

disp('performing amplitude demodulation');

AM_mod_hilb=hilbert(AM_mod);%pre_envelope=s(t)+j*\hat(s)(t)

AM_envelope=AM_mod_hilb.*exp(-j*2*pi*fc*t);%complex envelope

AM_env_abs=abs(AM_envelope);%envelope detector output

AM_demod=AM_env_abs-mean(AM_env_abs)%remove dc from output

disp('plotting the results');

figure;

subplot(4,1,1);plot(t,messwave);title('message wave form');

%xlabel('time'); ylabel('amplitude');

subplot(4,1,2);plot(t,carrwave);title('carr wave form');

%xlabel('time'); ylabel('amplitude');

subplot(4,1,3);plot(t,AM_mod);title('amplitude modulated wave form');

%xlabel('time'); ylabel('amplitude');

subplot(4,1,4);plot(t,AM_demod);

title('amplitude demodulated wave form');

%xlabel('time'); ylabel('amplitude');

disp('DIODE DETECTOR')

ac=input('ac');
if isempty(ac);
ac=1;
end
disp(sprintf('ac=%d',ac));
am=input('am');
if isempty(am);
am=1;
end
disp(sprintf('am=%d',am));

fc=100;
fm=10;
m=input('ENTER THE MODULATIION INDEX');
if isempty(m);
m=1;
end

fs=8*fc;
time=0.5;
t=0:(1/fs):time;
carr=ac*cos(2*pi*fc*t);
msg=am*cos(2*pi*fm*t);
am_mod=(1+m*cos(2*pi*fm*t)).*carr;

am_diode=am_mod;
for timeindex=1:length(t)
if(am_diode(timeindex)<0)
am_diode(timeindex)=0;
end
end

[den,num]=butter(1,2*pi*fm/fs);
am_demod1=filter(den,num,am_diode);
am_demod2=filter(den,num,am_demod1);
am_demod3=filter(den,num,am_demod2);
am_demod4=filter(den,num,am_demod3);
am_demod5=filter(den,num,am_demod4);

subplot(4,1,1);plot(t,msg);
title('message signal')
xlabel('time')
ylabel('amplitude');
subplot(4,1,2);plot(t,carr);
title('carr signal')
subplot(4,1,3);plot(t,am_mod);
title('amplitude modulated signal')
subplot(4,1,4);plot(t,am_demod5);
title('diode detected signal')
xlabel('time')
ylabel('amplitude');
disp('DOUBLE SIDE BAND MODULATION');
ac=input('enter the value of ac');
if isempty(ac)
ac=1;
end;
disp(sprintf('ac=%d',ac));
am=input('enter the value of am');
if isempty(am)
am=1;
end;
disp(sprintf('am=%d',am));
m=input('enter the value of m');
if isempty(m)
m=1
end;
disp(sprintf('m=%d',m));
fc=100;
fm=10;
fs=8*fc;
t=0:(1/fs):0.5;
msg=am*cos(2*pi*fm*t);
carr=ac*cos(2*pi*fc*t);
dsbsc=msg.*carr;
subplot(3,1,1);
plot(t,msg);
title('Message Signal');
subplot(3,1,2);
plot(t,carr);
title('Carrier Signal');
subplot(3,1,3);
plot(t,dsbsc);
title('DSBSC');

disp('DOUBLE SIDE BAND DEMODULATION');


ac=input('enter the value of ac');
if isempty(ac)
ac=1;
end;
disp(sprintf('ac=%d',ac));
am=input('enter the value of am');
if isempty(am)
am=1;
end;
disp(sprintf('am=%d',am));
m=input('enter the value of m');
if isempty(m)
m=1
end;
disp(sprintf('m=%d',m));
fc=100;
fm=10;
fs=8*fc;
t=0:(1/fs):0.5;
msg=am*cos(2*pi*fm*t);
carr=ac*cos(2*pi*fc*t);
dsbsc=msg.*carr;
r=1591549.431;
c=0.01*(10^-6);
h= (exp(-t/(r*c)))/(r*c);
disp(length(h))
x=dsbsc.*cos(2*pi*fc*t);
y=conv(x,h);
disp(length(y))
subplot(4,1,1);
plot(t,msg);
title('Message Signal');
subplot(4,1,2);
plot(t,carr);
title('Carrier Signal');
subplot(4,1,3);
plot(t,dsbsc);
title('DSBSC');
[den,num]=butter(1,2*pi*(fm/fs));
am_demod=filter(den,num,y);
subplot(4,1,4);
plot(am_demod)
title('Demodulated DSBSC');

disp('BALANCED MODULATION');
ac=input('enter the value of ac');
if isempty(ac)
ac=1;
end;
disp(sprintf('ac=%d',ac));
am=input('enter the value of am');
if isempty(am)
am=1;
end;
disp(sprintf('am=%d',am));
m=input('enter the value of m');
if isempty(m)
m=1
end;
disp(sprintf('m=%d',m));
fc=100;
fm=10;
fs=8*fc;
t=0:(1/fs):0.5;
msg=am*cos(2*pi*fm*t);
carr=ac*cos(2*pi*fc*t);
s1=(1+m*cos(2*pi*fm*t)).*carr;
s2=(1-m*cos(2*pi*fm*t)).*carr;
s=s1-s2;
subplot(5,1,1);
plot(t,msg);
title('Message Signal');
subplot(5,1,2);
plot(t,carr);
title('Carrier Signal');
subplot(5,1,3);
plot(t,s1);
title('S1');
subplot(5,1,4);
plot(t,s2)
title('S2');
subplot(5,1,5);
plot(t,s)
title('S1-S2');

You might also like