37
1.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')

AC Lab Simulation

Embed Size (px)

DESCRIPTION

ac lab manual software

Citation preview

Page 1: AC Lab Simulation

1.Amplitude Modulationt=0:0.0001:0.02msg=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')

Page 2: AC Lab Simulation

OUTPUT WAVEFORMS

Page 3: AC Lab Simulation
Page 4: AC Lab Simulation
Page 5: AC Lab Simulation

2.Demodulation of AM wave using Hilbert transformt=0:0.0001:0.02fc=1000Ec=7Carr=Ec*sin(2*pi*fc*t)fm=100Em=7Mod=Em*sin(2*pi*fm*t)Am=(Ec+Mod).*(sin(2*pi*fc*t))disp('Performing Amplitude Demodulation using Hilbert transform');Am_hil=hilbert(Am)Am_abs=abs(Am_hil)Am_Demod=Am_abs-mean(Am_abs)disp('plotting the results');figure;subplot(4,1,1);plot(t,Mod);title('Message Waveform');%xlabel('Time(sec)');ylabel('Amplitude'); subplot(4,1,2);plot(t,Carr);title('carrier waveform');%xlabel('Time(Sec)');ylabel('Amplitude');subplot(4,1,3);plot(t,Am);title('amplitude modulated wave form');%xlabel('Time(sec)');ylabel('Amplitude');subplot(4,1,4);plot(t,Am_Demod);title('Amplitude demodulated waveform');%xlabel('Time(sec)');ylabel('Amplitude');

Page 6: AC Lab Simulation

Output Waveforms

Page 7: AC Lab Simulation

3.Demodulation using Diode detectort=0:0.0001:0.02msg=16*cos(2*pi*200*t)carr=10*cos(2*pi*1000*t)subplot(4,1,1)plot(t,msg)title('Message waveform')subplot(4,1,2)plot(t,carr)title('Carrier waveform')amw=(10+msg).*cos(2*pi*1000*t)subplot(4,1,3)plot(t,amw)title('AM wave')for tim=1:200;if(amw(tim)<0)amw(tim)=0;endend[den,num]=butter(1,2*pi*0.025)for i=1:20amw=filter(den,num,amw);endsubplot(4,1,4)plot(t,amw)title('Demodulated waveform')

Page 8: AC Lab Simulation

Output Waveforms

Page 9: AC Lab Simulation

4.DSBSC Modulationt=0:0.0001:0.02;fc=1000Ec=3Carr=Ec*sin(2*pi*fc*t)fm=100Em=7Mod=Em*sin(2*pi*fm*t)DSBSC=Mod.*Carrsubplot(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

Page 10: AC Lab Simulation
Page 11: AC Lab Simulation

5.DSBSC Demodulationt=0:0.0001:0.02;fc=1000Ec=3Carr=Ec*sin(2*pi*fc*t)fm=100Em=7Mod=Em*sin(2*pi*fm*t)DSBSC=Mod.*Carrx=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')

Page 12: AC Lab Simulation

Output Waveform

Page 13: AC Lab Simulation

6.Generation DSBSC using Balanced Modulatort=0:0.0001:0.02fc=1000Ec=3fm=100m=3s1=Ec*(1+(m*cos(2*pi*fm*t))).*cos(2*pi*fc*t)s2=Ec*(1-(m*cos(2*pi*fm*t))).*cos(2*pi*fc*t)s=s1-s2subplot(3,1,1)plot(t,s1)title('Amplitude Modulated Signal 1')subplot(3,1,2)plot(t,s2)title('Amplitude Modulated Signal 2')subplot(3,1,3)plot(t,s)title('DSBSC')

Page 14: AC Lab Simulation

Output Waveforms

Page 15: AC Lab Simulation

7.SSBSC Modulationt=0:0.0001:0.04msg=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

Page 16: AC Lab Simulation
Page 17: AC Lab Simulation

8.Demodulation of SSBSCt=0:0.0001:0.04msg=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.08subplot(4,1,4)plot(k,demd)title('Demodulated waveform')

Page 18: AC Lab Simulation

Output Waveforms

Page 19: AC Lab Simulation

9.Frequency Spectrum of Amplitude Modulated Wavet=0:0.0001:0.02fc=1000Ec=7Carr=Ec*sin(2*pi*fc*t)fm=100Em=3Mod=Em*sin(2*pi*fm*t)Am=(Ec+Mod).*(sin(2*pi*fc*t))FA=fft(Am,1024)subplot(1,1,1)plot(fftshift(abs(FA)))axis([375 700 0 1000])title('frequency Spectrum of AmplitudeModulated Wave')

Output Waveform

Page 20: AC Lab Simulation
Page 21: AC Lab Simulation

10.Frequency Spectrum of Amplitude Modulated Wavet=0:0.0001:0.02fc=1000Ec=7Carr=Ec*sin(2*pi*fc*t)fm=100Em=3Mod=Em*sin(2*pi*fm*t)DSBSC=Carr.*ModFA=fft(DSBSC,1024)subplot(1,1,1)plot(fftshift(abs(FA)))axis([375 700 0 1000])title('frequency Spectrum of DSBSC Wave')

Output Waveform

Page 22: AC Lab Simulation
Page 23: AC Lab Simulation

11.Frequency Spectrum of SSBSCt=0:0.0001:0.04msg=5*cos(2*pi*200*t)carr=10*cos(2*pi*1000*t)ht=imag(Hilbert(msg))ssb1=(msg.*(carr/10))+(ht.*sin(2*pi*1000*t))FT=fft(ssb1)plot(abs(FT))title(‘Frequency Spectrum of SSBSC wave’)

Output Waveforms

Page 24: AC Lab Simulation
Page 25: AC Lab Simulation

12.Performing Pre-emphasis and De-emphasisf1=10;for f=1:50x(f)=(1/sqrt(1+(f1/f)^2));f2(f)=f;endsubplot(2,1,1);plot(f2,x);title('Pre-emphasis waveform')for f=1:50y(f)=(1/sqrt(1+(f/f1)^2));f3(f)=f;endsubplot(2,1,2);plot(f3,y);title('De-emphasis waveform')

Output Waveforms

Page 26: AC Lab Simulation
Page 27: AC Lab Simulation

13.Frequency ModulationAm=1; Ac=2fc=500; fm=200; fs=400kf=30dt=1/fsT=20e-3t=0:T/fs:Tmod=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

Page 28: AC Lab Simulation
Page 29: AC Lab Simulation

14.Demodulation of FM wave

Am=1;Ac=2;fc=500;fm=200;fs=400;kf=30dt=1/fsT=20e-3t=0:T/fs:Tmod=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=AMfor time_indx=1:lengthC; if(FM_Diode_out(time_indx)<0) FM_Diode_out(time_indx)=0; endendfs1=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) endsubplot(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')

Page 30: AC Lab Simulation

Output Waveforms

Page 31: AC Lab Simulation

15.Frequency Spectrum of FMAm=1Ac=2fc=500fm=200fs=400kf=30dt=1/fsT=20e-3t=0:T/fs:Tmod=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

Page 32: AC Lab Simulation
Page 33: AC Lab Simulation

16.Construction of SQUELCH circuitt=0:0.0001:0.02fc=1000;Ec=7Carr=Ec*sin(2*pi*fc*t)fm=100;Em=5Mod=Em*sin(2*pi*fm*t)Am=(Ec+Mod).*(sin(2*pi*fc*t))for t1=1:200 Am1(t1)=Am(t1)endfor t1=201:400 Am1(t1)=0endfor t1=401:600 Am1(t1)=Am(t1-400)enddisp(' Amplitude Demodulation using diode detector')lengthC=600;AM_Diode_out=Am1for time_indx=1:lengthC; if(AM_Diode_out(time_indx)<0) AM_Diode_out(time_indx)=0; endendfs=8000;[den,num]=butter(1,2*pi*fm/fs);AM_Demod=filter(den,num,AM_Diode_out);for n=1:10 AM_Demod=filter(den,num,AM_Demod) endsubplot(2,1,1);plot(Am1)title('Transmitted Signal')subplot(2,1,2);plot(AM_Demod)title('Squelch Circuit i.e after Quieting')

Page 34: AC Lab Simulation

Output Waveforms

Page 35: AC Lab Simulation