Top Banner
` 07 1 Program 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')
33

AC Lab Matlab Based Report

Mar 05, 2015

Download

Documents

Jeevan Prakash
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: AC Lab Matlab Based Report

`

071

Program 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')

Page 2: AC Lab Matlab Based Report

`

072

OUTPUT WAVEFORMS

Page 3: AC Lab Matlab Based Report

`

073

Page 4: AC Lab Matlab Based Report

`

074

Program 2: %Demodulation of AM wave using Hilbert transform t=0:0.0001:0.02 fc=1000 Ec=7 Carr=Ec*sin(2*pi*fc*t) fm=100 Em=7 Mod=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 5: AC Lab Matlab Based Report

`

075

Output Waveforms

Page 6: AC Lab Matlab Based Report

`

076

Program 3:

%Demodulation using Diode detector t=0:0.0001:0.02 msg=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; end end

[den,num]=butter(1,2*pi*0.025) for i=1:20

amw=filter(den,num,amw); end subplot(4,1,4) plot(t,amw) title('Demodulated waveform')

Page 7: AC Lab Matlab Based Report

`

077

Output Waveforms

Page 8: AC Lab Matlab Based Report

`

078

Program 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')

Page 9: AC Lab Matlab Based Report

`

079

Output Waveforms

Page 10: AC Lab Matlab Based Report

`

0710

Program 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')

Page 11: AC Lab Matlab Based Report

`

0711

Output Waveforms

Page 12: AC Lab Matlab Based Report

`

0712

Program 6: %Generation DSBSC using Balanced Modulator t=0:0.0001:0.02 fc=1000 Ec=3 fm=100 m=3 s1=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-s2 subplot(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 13: AC Lab Matlab Based Report

`

0713

Output Waveforms

Page 14: AC Lab Matlab Based Report

`

0714

Program 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')

Page 15: AC Lab Matlab Based Report

`

0715

Output Waveforms

Page 16: AC Lab Matlab Based Report

`

0716

Program 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')

Page 17: AC Lab Matlab Based Report

`

0717

Output Waveforms

Page 18: AC Lab Matlab Based Report

`

0718

Program 9: %Frequency Spectrum of Amplitude Modulated Wave t=0:0.0001:0.02 fc=1000 Ec=7 Carr=Ec*sin(2*pi*fc*t) fm=100 Em=3 Mod=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')

Page 19: AC Lab Matlab Based Report

`

0719

Output Waveform

Page 20: AC Lab Matlab Based Report

`

0720

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

Page 21: AC Lab Matlab Based Report

`

0721

Output Waveform

Page 22: AC Lab Matlab Based Report

`

0722

Program 11: %Frequency Spectrum 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)) ssb1=(msg.*(carr/10))+(ht.*sin(2*pi*1000*t)) FT=fft(ssb1) plot(abs(FT)) title(‘Frequency Spectrum of SSBSC wave’)

Page 23: AC Lab Matlab Based Report

`

0723

Output Waveforms

Page 24: AC Lab Matlab Based Report

`

0724

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

Page 25: AC Lab Matlab Based Report

`

0725

Output Waveforms

Page 26: AC Lab Matlab Based Report

`

0726

Program 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')

Page 27: AC Lab Matlab Based Report

`

0727

Output Waveforms

Page 28: AC Lab Matlab Based Report

`

0728

Program 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')

Page 29: AC Lab Matlab Based Report

`

0729

Output Waveforms

Page 30: AC Lab Matlab Based Report

`

0730

Program 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')

Page 31: AC Lab Matlab Based Report

`

0731

Output Waveforms

Page 32: AC Lab Matlab Based Report

`

0732

Program 16: %Construction of SQUELCH circuit t=0:0.0001:0.02 fc=1000;Ec=7 Carr=Ec*sin(2*pi*fc*t) fm=100;Em=5 Mod=Em*sin(2*pi*fm*t) Am=(Ec+Mod).*(sin(2*pi*fc*t)) for t1=1:200 Am1(t1)=Am(t1) end for t1=201:400 Am1(t1)=0 end for t1=401:600 Am1(t1)=Am(t1-400) end disp(' Amplitude Demodulation using diode detector') lengthC=600; AM_Diode_out=Am1 for time_indx=1:lengthC; if(AM_Diode_out(time_indx)<0) AM_Diode_out(time_indx)=0; end end fs=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) end subplot(2,1,1);plot(Am1) title('Transmitted Signal') subplot(2,1,2);plot(AM_Demod) title('Squelch Circuit i.e after Quieting')

Page 33: AC Lab Matlab Based Report

`

0733

Output Waveforms