AC Lab Simulation
AC Lab Simulation
Amplitude Modulation
t=0:0.0001:0.02
msg=10*cos(2*pi*100*t)
carr=20*cos(2*pi*1000*t)
amw=(20+msg).*cos(2*pi*1000*t)
subplot(2,1,1)
plot(t,msg)
title('Message signal')
subplot(2,1,2)
plot(t,carr)
title('Carrier signal')
figure;
subplot(3,1,1)
plot(t,amw)
title('Under Modulation')
msg=30*cos(2*pi*100*t)
amw=(20+msg).*cos(2*pi*1000*t)
subplot(3,1,2)
plot(t,amw)
title('over modulation')
msg=20*cos(2*pi*100*t)
amw=(20+msg).*cos(2*pi*1000*t)
subplot(3,1,3)
plot(t,amw)
title('100 % modulation')
OUTPUT WAVEFORMS
Output Waveforms
Output Waveforms
4.DSBSC Modulation
t=0:0.0001:0.02;
fc=1000
Ec=3
Carr=Ec*sin(2*pi*fc*t)
fm=100
Em=7
Mod=Em*sin(2*pi*fm*t)
DSBSC=Mod.*Carr
subplot(3,1,1)
plot(t,Mod)
title('Message waveform')
subplot(3,1,2)
plot(t,Carr)
title('Carrier waveform')
subplot(3,1,3)
plot(t,DSBSC)
title('DSBSC modulated waveform')
Output Waveforms
5.DSBSC Demodulation
t=0:0.0001:0.02;
fc=1000
Ec=3
Carr=Ec*sin(2*pi*fc*t)
fm=100
Em=7
Mod=Em*sin(2*pi*fm*t)
DSBSC=Mod.*Carr
x=DSBSC.*sin(2*pi*fc*t)
R=1000;
C=1.59*power(10,-6);
h=(1/(R*C))*exp(-t/(R*C))
y=conv(x,h)
subplot(3,1,1)
plot(t,Mod)
title('Modulating Signal')
subplot(3,1,2)
plot(t,DSBSC)
title('Double Side Band Suppressed Carrier')
subplot(3,1,3)
plot(y)
axis([0 200 -1.5*power(10,5) 1.5*power(10,5)])
title('DSBSC after Demodulation')
Output Waveform
Output Waveforms
7.SSBSC Modulation
t=0:0.0001:0.04
msg=5*cos(2*pi*200*t)
carr=10*cos(2*pi*1000*t)
ht=imag(Hilbert(msg))
subplot(3,1,1)
plot(t,msg)
title('Message waveform')
subplot(3,1,2)
plot(t,carr)
title('Carrier Waveform')
ssb1=(msg.*(carr/10))+(ht.*sin(2*pi*1000*t))
subplot(3,1,3)
plot(t,ssb1)
title('SSBSC')
Output Waveforms
8.Demodulation of SSBSC
t=0:0.0001:0.04
msg=5*cos(2*pi*200*t)
carr=10*cos(2*pi*1000*t)
ht=imag(Hilbert(msg))
subplot(4,1,1)
plot(t,msg)
title('Message waveform')
subplot(4,1,2)
plot(t,carr)
title('Carrier Waveform')
ssb1=(msg.*(carr/10))+(ht.*sin(2*pi*1000*t))
subplot(4,1,3)
plot(t,ssb1)
title('SSBSC Modulated wave')
impres=(400*pi)*exp(-t*400*pi)
demd=conv((ssb1.*(carr/10)),impres)
k=0:0.0001:0.08
subplot(4,1,4)
plot(k,demd)
title('Demodulated waveform')
Output Waveforms
Output Waveform
Output Waveform
Output Waveforms
Output Waveforms
13.Frequency Modulation
Am=1; Ac=2
fc=500; fm=200; fs=400
kf=30
dt=1/fs
T=20e-3
t=0:T/fs:T
mod=Am*cos(2*pi*fm*t)
FM=Ac*cos(2*pi*fc*t+(2*pi*kf*(cumsum(mod)*dt)))
subplot(2,1,1)
plot(t,mod)
axis([0 0.02 -5 5])
title('Message Signal')
subplot(2,1,2)
plot(t,FM)
axis([0 0.02 -5 5])
title('FM Signal')
Output Waveforms
14.Demodulation of FM wave
Am=1;Ac=2;fc=500;fm=200;fs=400;kf=30
dt=1/fs
T=20e-3
t=0:T/fs:T
mod=Am*cos(2*pi*fm*t)
FM=Ac*cos(2*pi*fc*t+(2*pi*kf*(cumsum(mod)*dt)))
AM=diff(FM)
lengthC=400;
FM_Diode_out=AM
for time_indx=1:lengthC;
if(FM_Diode_out(time_indx)<0)
FM_Diode_out(time_indx)=0;
end
end
fs1=8000;
[den,num]=butter(1,2*pi*fm/fs1);
FM_Demod=filter(den,num,FM_Diode_out);
for n=1:100
FM_Demod=filter(den,num,FM_Demod)
end
subplot(3,1,1)
plot(t,mod);axis([0 0.01 -5 5])
title('Message Signal')
subplot(3,1,2)
plot(t,FM);axis([0 0.01 -5 5])
title('FM Signal')
subplot(3,1,3)
plot(FM_Demod);axis([200 400 0 0.4])
title('FM demodulated signal')
Output Waveforms
15.Frequency Spectrum of FM
Am=1
Ac=2
fc=500
fm=200
fs=400
kf=30
dt=1/fs
T=20e-3
t=0:T/fs:T
mod=Am*cos(2*pi*fm*t)
FM=Ac*cos(2*pi*fc*t+(2*pi*kf*(cumsum(mod)*dt)))
FFM=fft(FM)
plot(abs(FFM))
title('Frequency Spectrum')
Output Waveforms
Output Waveforms