You are on page 1of 13

EXPERIMENT 11 Date Perform: ________________

To Demonstrate the FSK and PSK Modulation & Demodulation

11.1 OBJECTIVE:
 To perform Amplitude Shift Keying modulation and demodulation of signals in
MATLAB

11.2 EQUIPMENT:
 MATLAB

11.3 BACKGROUND:
Experiment 11 in lab manual.

11.4 Procedure:
Look at the following algorithm for the FSK:

Generate the input digital data sequence


Differentiate the 0s and 1s
Generate a high frequency signal for 1s
low frequency signal for 0s
Assign high frequency signal against 1s
low frequency signal against 0s
Combine the above signals to get FSK signal

Task 1:
Based on the above algorithm you need to write a MATLAB code for FSK modulation!

And test your code for the same input sequence as you did in the last lab.

18f0535

At 5

clear all;
close all;
b = [0 1 0 1]
n = length(b);
t = 0:.01:n;
x = 1:1:(n+1)*100;
for i = 1:n
if (b(i) == 0)
bs(i) = -1;
else
bs(i) = 1;
end
for j = i:.1:i+1
bw(x(i*100:(i+1)*100)) = bs(i);
end
end
bw = bw(100:end);
yo = 3*sin(2*pi*t);
y= 2*sin(2*pi*t);
x1= (yo+y);
x2 =(yo-y);
fsk= sin(yo+(bw).*y);
subplot(4,1,1)
plot(t,bw)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('message signal')
subplot(4,1,2)
plot(t,x1)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('high frequency ')
subplot(4,1,3)
plot(t,x2)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('low frquency')
subplot(4,1,4)
plot(t,fsk)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('final fsk signal')
At 3
clear all;
close all;
b = [0 0 1 1]
n = length(b);
t = 0:.01:n;
x = 1:1:(n+1)*100;
for i = 1:n
if (b(i) == 0)
bs(i) = -1;
else
bs(i) = 1;
end
for j = i:.1:i+1
bw(x(i*100:(i+1)*100)) = bs(i);
end
end
bw = bw(100:end);
yo = 3*sin(2*pi*t);
y= 2*sin(2*pi*t);
x1= (yo+y);
x2 =(yo-y);
fsk= sin(yo+(bw).*y);
subplot(4,1,1)
plot(t,bw)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('message signal')
subplot(4,1,2)
plot(t,x1)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('high frequency ')
subplot(4,1,3)
plot(t,x2)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('low frquency')
subplot(4,1,4)
plot(t,fsk)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('final fsk signal')

At 5

clear all;
close all;
b = [0 1 0 1]
n = length(b);
t = 0:.01:n;
x = 1:1:(n+1)*100;
for i = 1:n
if (b(i) == 0)
bs(i) = -1;
else
bs(i) = 1;
end
for j = i:.1:i+1
bw(x(i*100:(i+1)*100)) = bs(i);
end
end
bw = bw(100:end);
yo = 3*sin(2*pi*t);
y= 2*sin(2*pi*t);
x1= (yo+y);
x2 =(yo-y);
fsk= sin(yo+(bw).*y);
subplot(4,1,1)
plot(t,bw)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('message signal')
subplot(4,1,2)
plot(t,x1)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('high frequency ')
subplot(4,1,3)
plot(t,x2)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('low frquency')
subplot(4,1,4)
plot(t,fsk)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('final fsk signal')
At A[1010]

clear all;
close all;
b = [1 0 1 0]
n = length(b);
t = 0:.01:n;
x = 1:1:(n+1)*100;
for i = 1:n
if (b(i) == 0)
bs(i) = -1;
else
bs(i) = 1;
end
for j = i:.1:i+1
bw(x(i*100:(i+1)*100)) = bs(i);
end
end
bw = bw(100:end);
yo = 3*sin(2*pi*t);
y= 2*sin(2*pi*t);
x1= (yo+y);
x2 =(yo-y);
fsk= sin(yo+(bw).*y);
subplot(4,1,1)
plot(t,bw)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('message signal')
subplot(4,1,2)
plot(t,x1)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('high frequency ')
subplot(4,1,3)
plot(t,x2)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('low frquency')
subplot(4,1,4)
plot(t,fsk)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('final fsk signal')

Task 2:
For your roll number as the input, apply PSK modulation and demodulation.
18f0535

At 5

clear all;
close all;
b = [0 1 0 1]
n = length(b);
t = 0:.01:n;
x = 1:1:(n+1)*100;
for i = 1:n
if (b(i) == 0)
bs(i) = -1;
else
bs(i) = 1;
end
for j = i:.1:i+1
bw(x(i*100:(i+1)*100)) = bs(i);
end
end
bw = bw(100:end);
fs=5;
x = sin(2*pi*fs*t);
psk = bw.*x;
dem=psk./x
subplot(4,1,1)
plot(t,bw)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('message signal')
subplot(4,1,2)
plot(t,x)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('carrier signal ')
subplot(4,1,3)
plot(t,psk,'r')
grid on ;
xlabel(' time')
ylabel('amplitude')
title('psk signal modulation')
subplot(4,1,4)
plot(t,dem,'g')
grid on ;
xlabel(' time')
ylabel('amplitude')
title('demodulation of psk')
At 3

clear all;
close all;
b = [0 0 1 1]
n = length(b);
t = 0:.01:n;
x = 1:1:(n+1)*100;
for i = 1:n
if (b(i) == 0)
bs(i) = -1;
else
bs(i) = 1;
end
for j = i:.1:i+1
bw(x(i*100:(i+1)*100)) = bs(i);
end
end
bw = bw(100:end);
fs=5;
x = sin(2*pi*fs*t);
psk = bw.*x;
dem=psk./x
subplot(4,1,1)
plot(t,bw)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('message signal')
subplot(4,1,2)
plot(t,x)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('carrier signal ')
subplot(4,1,3)
plot(t,psk,'r')
grid on ;
xlabel(' time')
ylabel('amplitude')
title('psk signal modulation')
subplot(4,1,4)
plot(t,dem,'g')
grid on ;
xlabel(' time')
ylabel('amplitude')
title('demodulation of psk')

At 5
clear all;
close all;
b = [0 1 0 1]
n = length(b);
t = 0:.01:n;
x = 1:1:(n+1)*100;
for i = 1:n
if (b(i) == 0)
bs(i) = -1;
else
bs(i) = 1;
end
for j = i:.1:i+1
bw(x(i*100:(i+1)*100)) = bs(i);
end
end
bw = bw(100:end);
fs=5;
x = sin(2*pi*fs*t);
psk = bw.*x;
dem=psk./x
subplot(4,1,1)
plot(t,bw)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('message signal')
subplot(4,1,2)
plot(t,x)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('carrier signal ')
subplot(4,1,3)
plot(t,psk,'r')
grid on ;
xlabel(' time')
ylabel('amplitude')
title('psk signal modulation')
subplot(4,1,4)
plot(t,dem,'g')
grid on ;
xlabel(' time')
ylabel('amplitude')
title('demodulation of psk')
At A[1010]

clear all;
close all;
b = [1 0 1 0]
n = length(b);
t = 0:.01:n;
x = 1:1:(n+1)*100;
for i = 1:n
if (b(i) == 0)
bs(i) = -1;
else
bs(i) = 1;
end
for j = i:.1:i+1
bw(x(i*100:(i+1)*100)) = bs(i);
end
end
bw = bw(100:end);
fs=5;
x = sin(2*pi*fs*t);
psk = bw.*x;
dem=psk./x
subplot(4,1,1)
plot(t,bw)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('message signal')
subplot(4,1,2)
plot(t,x)
grid on ;
xlabel(' time')
ylabel('amplitude')
title('carrier signal ')
subplot(4,1,3)
plot(t,psk,'r')
grid on ;
xlabel(' time')
ylabel('amplitude')
title('psk signal modulation')
subplot(4,1,4)
plot(t,dem,'g')
grid on ;
xlabel(' time')
ylabel('amplitude')
title('demodulation of psk')

You might also like