0% found this document useful (0 votes)
20 views3 pages

DC Practical 6

The document describes a Matlab simulation of FSK modulation and demodulation. It defines a bit sequence, uses it to generate an FSK modulated signal by varying the carrier frequency between f1 and f2. It then demodulates the FSK signal using envelope detection and compares the results to the original bit sequence. Key steps include FSK modulation using two carrier frequencies, demodulation by multiplying with each carrier and integrating, and comparing the results to detect bits.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

DC Practical 6

The document describes a Matlab simulation of FSK modulation and demodulation. It defines a bit sequence, uses it to generate an FSK modulated signal by varying the carrier frequency between f1 and f2. It then demodulates the FSK signal using envelope detection and compares the results to the original bit sequence. Key steps include FSK modulation using two carrier frequencies, demodulation by multiplying with each carrier and integrating, and comparing the results to detect bits.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Name : Kshitij Shinde REG NO: 2021BEC513

Sub : Digital Communication Roll No: A73

PRACTICAL : 04

Aim : To Study FSK Modulation and Demodulation.

Matlab Code:

clc;
clear all;
close all;

x=[ 1 0 0 1 1 0 1];
bp=.000001;

bit=[];
for n=1:1:length(x)
if x(n)==1;
se=ones(1,100);
else x(n)==0;
se=zeros(1,100);
end
bit=[bit se];

end
t1=bp/100:bp/100:100*length(x)*(bp/100);
subplot(3,1,1);
plot(t1,bit,'lineWidth',2.5);grid on;
axis([ 0 bp*length(x) -.5 1.5]);
ylabel('Amplitude');
xlabel(' Time');
title('BIT Sequence');
A=5;
br=1/bp;
f1=br*8;
f2=br*2;
t2=bp/99:bp/99:bp;
ss=length(t2);
m=[];
for (i=1:1:length(x))
if (x(i)==1)
y=A*cos(2*pi*f1*t2);
else
y=A*cos(2*pi*f2*t2);
end
m=[m y];
end
t3=bp/99:bp/99:bp*length(x);
subplot(3,1,2);
plot(t3,m);
xlabel('Time');
ylabel('Amplitude');
title('FSK modulation');

mn=[];
for n=ss:ss:length(m)
t=bp/99:bp/99:bp;
y1=cos(2*pi*f1*t);
y2=cos(2*pi*f2*t);
mm=y1.*m((n-(ss-1)):n);
mmm=y2.*m((n-(ss-1)):n);
t4=bp/99:bp/99:bp;
z1=trapz(t4,mm)
z2=trapz(t4,mmm)
zz1=round(2*z1/bp)
zz2= round(2*z2/bp)
if(zz1>A/2)
a=1;
else(zz2>A/2)
a=0;
end
mn=[mn a];
end

bit=[];
for n=1:length(mn);
if mn(n)==1;
se=ones(1,100);
else mn(n)==0;
se=zeros(1,100);
end
bit=[bit se];
end
t4=bp/100:bp/100:100*length(mn)*(bp/100);
subplot(3,1,3)
plot(t4,bit,'LineWidth',2.5);grid on;
axis([ 0 bp*length(mn) -.5 1.5]);
ylabel('Amplitude');
xlabel('Time');
title('FSK demodulation');

Output:

You might also like