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

Digital Comm Practicals

The document contains 5 MATLAB programs that simulate different digital modulation techniques: 1. Impulse sampling technique 2. Natural sampling technique 3. Amplitude shift keying (ASK) modulation 4. Frequency shift keying (FSK) modulation 5. Phase shift keying (PSK) modulation Each program generates the modulated signal and demodulated signal and plots them for verification.

Uploaded by

Akanksha Dixit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views

Digital Comm Practicals

The document contains 5 MATLAB programs that simulate different digital modulation techniques: 1. Impulse sampling technique 2. Natural sampling technique 3. Amplitude shift keying (ASK) modulation 4. Frequency shift keying (FSK) modulation 5. Phase shift keying (PSK) modulation Each program generates the modulated signal and demodulated signal and plots them for verification.

Uploaded by

Akanksha Dixit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 9

1.

WAP to simulate Impulse Sampling technique using MATLAB


& verify the received sampled waveform.
MATLAB PROGRAM:-
clear all;
close all;
clc;
fb=1000; %baseband signal freqquency in hetz
tb=1/fb;
fs=40000;
ns=fs/fb; %number of samples in one period of the base band
signal
t=linspace(0,.002,ns);
sq=(1+square(t))/2;
x=sin(2*pi*fb*t);
asb=5*x.*sq;
subplot(311);
plot(t,x);
subplot(312);
stem(t,sq);
axis([0 .002 0 1]);
xlabel('time in seconds');
ylabel('amplitude in volts');
title('square wave output');
subplot(313);
stem(t,asb);
axis([0 .002 -5 5]);
xlabel('time in seconds');
ylabel('amplitude in volts');
title('simulation of samplig process');

OUTPUT
2-WAP to simulate Natural Sampling technique using MATLAB
& verify the received sampled waveform.
MATLAB PROGRAM:-
clc;
clear all;
t = 0:0.001:1;
fc = input('Enter the frequency of carrier signal (square) = ');
fm = input('Enter the frequency of message signal (sine) = ');
a = input('Enter the amplitude of message signal = ');
vc = square(2*pi*fc*t);
vm = a.*sin(2*pi*fm*t);
n = length(vc);
for i = 1:n
if (vc(i)<=0)
vc(i) = 0;
else
vc(i) = 1;
end
end
y = vc.*vm;
subplot(3,1,1);
plot(t,vm);
xlabel('Time ----->');
ylabel('Amplitude ----->');
title('Message Signal');
axis([0 1 -a-2 a+2]);
grid on;
subplot(3,1,2);
plot(t,vc);
xlabel('Time ----->');
ylabel('Amplitude ----->');
title('Carrier Signal');
axis([0 1 0 2]);
grid on;
subplot(3,1,3);
plot(t,y);
xlabel('Time ----->');
ylabel('Amplitude ----->');
title('Natural Sampled Signal');
axis([0 1 -a-2 a+2]);
grid on;

Output:

Enter the frequency of carrier signal (square) = 20


Enter the frequency of message signal (sine) = 2
Enter the amplitude of message signal = 5
3. WAP to simulate Amplitude shift keying modulation using
MATLAB & verify modulated signal waveform.
MATLAB PROGRAM:-
clc;
clear all;
close all; % Carrier frequency and amplitude
f=7;
a=1; %6 bits are used
n=[1 0 1 1 0 0];
l=length(n);
if n (1)==1
n(l+1)=1
else
n(l+1)=0
end
l1=length(n)
tn=0:l1-1; %plot message signal
subplot(4,1,1);
stairs(tn,n);
title('message signal');
xlabel('time');
ylabel('amplitude'); %plot carrier signal
t=0:0.01:6;
y1=a*sin(2*pi*f*t);
subplot(4,1,2);
plot(t,y1);
title('carrier signal');
xlabel('time');
ylabel('amplitude'); % Modulation Process
for i=1:6
for j=(i-1)*100:i*100
if(n(i)==1)
s(j+1)=y1(j+1);
else
s(j+1)=0;
end
end
end %plot ASK signal
subplot(4,1,3);
plot(t,s);
title('ASK modulated signal');
xlabel('time');
ylabel('amplitude'); % Demodulation process
for i=1:6
for j=(i-1)*100:i*100
if(s(j+1)==y1(j+1))
x(j+1)=1;
else
x(j+1)=0;
end
end
end %plot demodulated signal
subplot(4,1,4);
plot(t,x);
title('ASK demodulated signal');
xlabel('time');
ylabel('amplitude');

Output:
4.WAP to simulate Frequency shift keying modulation using
MATLAB & verify modulated signal waveform.
MATLAB PROGRAM:-
clc;
clear all;
close all; % Carrier frequency and amplitude
f1=8;
f2=2;
a=1; %6 bits are used
n=[1 0 1 1 0 0];
l=length(n);
if n (1)==1
n(l+1)=1
else
n(l+1)=0
end
l1=length(n)
tn=0:l1-1; %plot message signal
subplot(5,1,1);
stairs(tn,n);
title('message signal');
xlabel('time');
ylabel('amplitude'); %plot carrier signal
t=0:0.01:6;
y1=a*sin(2*pi*f1*t);
y2=a*sin(2*pi*f2*t);
subplot(5,1,2);
plot(t,y1);
title('carrier signal1');
xlabel('time');
ylabel('amplitude');
subplot(5,1,3);
plot(t,y2);
title('carrier signal2');
xlabel('time');
ylabel('amplitude'); % Modulation Process
for i=1:6
for j=(i-1)*100:i*100
if(n(i)==1)
s(j+1)=y1(j+1);
else
s(j+1)=y2(j+1);
end
end
end %plot FSK signal
subplot(5,1,4);
plot(t,s);
title('FSK modulated signal');
xlabel('time');
ylabel('amplitude'); % Demodulation process
for i=1:6
for j=(i-1)*100:i*100
if(s(j+1)==y1(j+1))
x(j+1)=1;
else
x(j+1)=0;
end
end
end %plot demodulated signal
subplot(5,1,5);
plot(t,x);
title('FSK demodulated signal');
xlabel('time');
ylabel('amplitude');

Output:
5.WAP to simulate Phase shift keying modulation using
MATLAB & verify modulated signal waveform.
MATLAB PROGRAM:-
clc;
clear all;
close all; % Carrier frequency and amplitude
f=5;
a=1; %6 bits are used
n=[1 0 1 1 0 0];
l=length(n);
if n (1)==1
n(l+1)=1
else
n(l+1)=0
end
l1=length(n)
t2=0:l1-1; %plot message signal
subplot(5,1,1);
stairs(t2,n);
title('message signal');
xlabel('time');
ylabel('amplitude'); %plot carrier signal
t=0:0.01:6;
y1=a*sin(2*pi*f*t);
y2=a*sin(2*pi*f*t);
subplot(5,1,2);
plot(t,y1);
title('carrier signal1');
xlabel('time');
ylabel('amplitude');
subplot(5,1,3);
plot(t,y2);
title('carrier signal2');
xlabel('time');
ylabel('amplitude'); % Modulation Process
for i=1:6
for j=(i-1)*100:i*100
if(n(i)==1)
s(j+1)=y1(j+1);
else
s(j+1)=y2(j+1);
end
end
end %plot PSK signal

subplot(5,1,4);
plot(t,s);
title('PSK modulated signal');
xlabel('time');
ylabel('amplitude'); % Demodulation process
for i=1:6
for j=(i-1)*100:i*100
if(s(j+1)==y1(j+1))
x(j+1)=1;
else
x(j+1)=0;
end
end
end %plot demodulated signal
subplot(5,1,5);
plot(t,x);
title('PSK demodulated signal');
xlabel('time');
ylabel('amplitude');

Output:

You might also like