0% found this document useful (0 votes)
11 views

ADC Software Programs

Uploaded by

raju330816
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

ADC Software Programs

Uploaded by

raju330816
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

SSB- MODULATION AND DETECTOR

Title of the Experiment: Generation of SSB-SC Modulation

AIM: To perform the generation of Amplitude SSB-SC modulation using MATLAB.

APPARATUS REQUIRED:

1. Hardware Tools: Computer System


2. Software Tools: MATLAB (signal processing Tool)

Program (MATLAB CODE):

fs=8000;
fm=20;
fc=50;
am=1;
ac=1;
t={[0:0.1*fs]/fs;
subplot(5,1,1);
m1 =am*cos(2*pi*fm*t);
plot(t,m1);
title(‘message signal’);
m2=am*sin(2*pi*fm*t);
subplot(5,1,2);
c1=ac*cos(2*pi*fc*t);
plot(t,c1);
title(‘carrier signal’)l;
c2=ac*sin(2*pi*fc*t);
subplot(5,1,3);
%susb=0.5*am*cos(2*pi*fm*t).*ac*cos(2*pi*fc*t)--
0.5*am*sin(2*pi*fm*t).*ac*sin(2*pi*fc*t);
Susb=0.5*m1.*c1-0.5*m2.*c2;
Plot(t,susb);
Title(‘ssb-sc signal with usb’);
Subplot(5,1,4);
Slsb=0.5*m1.*c1+0.5*m2.*c2;
Plot(t,slsb);
SIMULATION RESULT:
Exp no: Date:
PULSE AMPLITUDEDE MODULATION AND DEMODULATION

Title of the Experiment: Generation of PAM Signal

AIM: To perform the generation of Pulse Amplitude modulation using MATLAB.

APPARATUS REQUIRED:

3. Hardware Tools: Computer System


4. Software Tools: MATLAB (signal processing Tool)

Program (MATLAB CODE):


fs=8000;
fm=20;
fc=500;
Am=1
Ac=1
t=[0:0.1*fs]/fs;
m=Am*cos(2*pi*fm*t);
c=Ac*cos(2*pi*fc*t);
Ka=0.5;
U=Ka*Am;
s1=Ac*(1+U*cos(2*pi*fm*t)).*(cos(2*pi*fc*t));
subplot(4,3,1:3);
plot(t,m);
title('modulating or message signal,(fm=20hz)');
subplot(4,3,4:6);
plot(t,c);
title('carrier signal (tc:500hz)');
subplot(4,3,7);
plot(t5,s1);
title(' modulated signal(ka*Am=0.5)');
Am=2;
Ka=0.5;
U=Ka*Am;
s2=Ac*(1+4*cos(2*pi*fm*t)).*(cos(2*pi*fc*t));
subplot(4,3,8);
plot(t,s2);
title('exact modulated signal(Ka*Am=1)');
Am=5;
Ka=0.5;
U=Ka*Am;
s3=Ac*(1+U*cos(2*pi*fm*t).*cos(2*pi*fc*t));
subplot(4,3,9);
plot(t,s3);
title('over modulated signal(Ka:Am=2.5)');
r1=s1.*c;
[b,a]=butter(1,0.01)
; mr1=filter(b,a,r1);
subplot(4,3,10);
plot(t,mr1);
title('demodulated signal for(Ka*Am=0.5)');
r2=s2.*c;
[b,a]=butter(1,0.01)
; mr2=filter(b,a,r2);
subplot(4,3,11);
plot(t,mr2);
title('demodulated signal for(Ka*Am=1)');
r3=s3.*c;
[b,a]=butter(1,0.01)
; mr3=filter(b,a,r3);
subplot(4,3,12);
plot(t,mr3);
title('demodulated signal for(Ka*Am=2.5)');
SIMULATION RESULT:
Exp no: Date:
PULSE WIDTH MODULATION AND DEMODULATION MATELAB CODE:

AIM: To perform the pulse width modulation and demodulation using MATLAB.

APPARATUS REQUIRED:

1. Hardware Tools: Computer System

2. Software Tools :MATLAB (signal processing tool)

Program:
close all
clear all
clc
fc=1000;
fs=10000;
f1=200;
t=0:1/fs:((2/f1)-(1/fs));
x1=0.4*cos(2*pi*f1*t)+0.5;
%modulation
y1=modulate(x1,fc,fs,'pwm');
subplot(411);
plot(x1);
axis([0 100 0 1]);
title('modulating signal,f1=200,fs=10000')
subplot(412);
plot(y1);
axis([0 1000 -0.2 1.2]);
title('PWM')
%demodulation
x1_recov=demod(y1,fc,fs,'pwm');
[den,num]=butter(1,2*pi*f1/fs);
s11=filter(den,num,x1_recov);
s12=filter(den,num,s11);
subplot(413);
plot(x1_recov);
title('time domain recovered,single
tone,f1=200') axis([0 100 0 1]);
subplot(414);
plot(s12);
title('filtered
output') axis([0 100
0 1]);
SIMULATION RESULT:
Exp no: Date:
PULSE POSITION MODULATION AND DEMODULATION

AIM: To Study and verify the pulse position modulation &demodulation.

APPARATUS REQUIRED:

1.Hardware Tools: Computer System


2.Software Tools: MATLAB (signal processing tool)

PROGRAM:MATLAB CODE:

close all
clear all
clc
fc=100;
fs=1000;
f1=80;
t=0:1/fs:((2/f1)-(1/fs));
x1=0.4*cos(2*pi*f1*t)+0.5;
%modulation
y1=modulate(x1,fc,fs,'ppm');
subplot(3,1,1);
plot(x1);
axis([0 15 0 1]);
title('modulating signal,f1=80,fs=1000bn
') subplot(3,1,2);
plot(y1);
axis([0 250 -0.2 1.2]);
title('PPM')
%demodulation
x1_recov=demod(y1,fc,fs,'ppm');
subplot(3,1,3);
plot(x1_recov);
title('time domain recovered, single tone,
f1=80')

axis([0 15 0 1]);
SIMULATION RESULT:
Exp no: Date:

PHASE LOCKED LOOP


MATLAB CODE:
reg1=0;
reg2=0;
reg3=0;
eta=sqrt(2)/;
theta=2*pi*1/100;
Kp=[(4*eta*theta)/
(1+2*eta*theta+theta^2)];
Ki=[(4*theta^2)/(1+2*eta*theta+theta^2)];
d_phi_1=1/20;
n_data=100;
for nn=1:n_data
phi1=reg1+d_phi_1;
phi1_reg(nn)=phi1;
s1=exp(j*2*pi*reg1);
s2=exp(j*2*pi*reg2);
s1_reg(nn)=s1;
s2_reg(nn)=s2;
t=s1*conj(s2);
phi_error=atan(imag(t)/real(t))/(2*pi);
phi_error_reg(nn)=phi_error;
sum1=Kp*phi_error+phi_error*Ki+reg3;
reg1_reg(nn)=reg1;
reg2_reg(nn)=reg2;
reg1=phi1;
reg2=reg2+sum1;
reg3=reg3+phi_error*Ki;
phi2_reg(nn)=reg2;
end
figure(1)
plot(phi1_reg);
hold on
plot(phi2_reg,'r')
hold off;
grid on;
title('phase plot');
xlabel('Samples');
ylabel('Phase');
figure(2)
plot(phi_error_reg)
;
title('Phase error of phase
detector'); grid on;
xlabel('Samples(n)');
ylabel('Phase
error(degrees)'); figure(3)
plot(real(s1_reg));
hold on;
plot(real(s2_reg),'r')
; hold off;
grid on;
title('Input signal and output signal of VCO');
xlabel('Samples');
ylabel('Amplitude');
axis([0 n_data-1.1 1.1]);
SIMULATION RESULT:
Exp no: Date:
SPECTRUM ANALYSIS OF MODULATION SIGNAL
USING SPECTRUM ANALZER
MATLAB CODE:
fs=100;
t=[0:2*fs+1]'/fs;
fc=10;
x=sin(2*pi*2*t);
Ac=1;
Xam=ammod(X,fc,fs,o,ac);
Zam=fft(Xam);
Zam=abs(Zam(1:length(Zam)/2+1));
frqam=[0:length(Zam)-1]*fs/length(Zam)/2;
Ydouble=ammod(X,fc,fs,fs,3.14,0);
Zdouble=fft(ydouble);
Zdouble=abs(zdouble(1:length(zdouble)/2+1));
frqdouble=[0:length(zdouble)-1]*fs/length(zdouble)/
2; ysingle=ssbmod(x,fc,fs,0,'upper');
zsingle=fft(ysingle);
zsingle=abs(zsingle(1:length(zsingle)/2+1));
frqsingle=[0:length(zsingle)-1]*fs/lengt(zsingle)/2;
figure;
subplot(3,1,1);
plot(frqam,zam);
title('spectrum of am
signal'); subplot(3,1,2);
plot(frqdouble,zdouble);
title('spectrum of double-
sidebandsignal');
subplot(3,1,3);plot(frqsingle,zsingle);
xfm=fmmod(x,fc,fs,10);
zfm=fft(xfm);
zfm=abs(zfm(1:length(zfm)/2+1));
frqfm=[0:length(zfm)-1]*fs/length(zfm)/2
;

figure;
plot(frqfm,zfm)
;
title('spectrum of fm signal');
Exp no: Date:
1. SAMPLING THEOREM
MATLAB CODE:
clear all;
close all;
clc;
tfinal=0.05;
t=0:0.0005:tfinal;fm=input('enter the analotg
frequency'); xt=cos(2*pi*fm*t);
fsl=1.3*fm;
nl=0:2/fsl:tfinal;
xn=cos(2*pi*nl*fm);
subplot(3,1,1);
plot(t,xt,'b',nl,xn,'r');
title('under sampling
plot'); fs2=2*fm;
n2=0:1/fs2:tfinal;
xn=cos(2*pi*fm*n2);
subplot(3,1,2);
plot(t,xt,'b',n2,xn,'r');
title('nyquist plot');
fs3=5*fm;
n3=0:1/fs3:tfinal;
xn=cos(2*pi*fm*n3);
subplot(3,1,3);
plot(t,xt,'b',n3,xn,'r');
title('over sampling plot');
xlabel('time');
ylabel('amplitude');
SIMULATION RESULT:

You might also like