Professional Documents
Culture Documents
PAGE NUMBERS
1. AMPLITUDE MODULATION………………………………………………………………….
2. AMPLITUDE DEMODULATION……………………………………………………………
3. DIODE DETECTOR………………………………………………………………………………
6. BALANCE MODULATION………………………………………………………………………..
9. AMPLITUDE SPECTRUM………………………………………………………………………….
if isempty(ac)
ac=1;
end
disp(sprintf('ac=%d',ac));
if isempty(am)
am=1
end
disp(sprintf('am=%d',am));
fc=100;
fm=10;
if isempty(m)
m=1;
end
if isempty(n)
n=0.5;
end
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');
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));
if isempty(am)
am=1;
end
disp(sprintf('am=%d',am));
if isempty(fm)
fm=10;
end
disp(sprintf('fm=%d',fm));
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);
AM_mod=(1+modnindex*messwave).*carrwave;
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
figure;
%xlabel('time'); ylabel('amplitude');
%xlabel('time'); ylabel('amplitude');
%xlabel('time'); ylabel('amplitude');
subplot(4,1,4);plot(t,AM_demod);
%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('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');