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

Mat Lab Program For F SK Transmitter and Receiver

This MATLAB code simulates frequency shift keying (FSK) modulation and demodulation. It generates a message signal, two carrier signals at different frequencies, modulates the message signal onto the carrier signals to create the FSK signal, and then demodulates the FSK signal to recover the original message signal. Key steps include generating the message signal and two carriers, modulating the message onto the carriers in an FSK scheme, plotting the FSK output signal, demodulating the FSK output to recover the message, and plotting the demodulated message signal.

Uploaded by

ben ten
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)
130 views3 pages

Mat Lab Program For F SK Transmitter and Receiver

This MATLAB code simulates frequency shift keying (FSK) modulation and demodulation. It generates a message signal, two carrier signals at different frequencies, modulates the message signal onto the carrier signals to create the FSK signal, and then demodulates the FSK signal to recover the original message signal. Key steps include generating the message signal and two carriers, modulating the message onto the carriers in an FSK scheme, plotting the FSK output signal, demodulating the FSK output to recover the message, and plotting the demodulated message signal.

Uploaded by

ben ten
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

% MATLAB Program for FSK Transmitter and Receiver

% Code by Ajeet Kumar BKP Academy


% Modify May 12, 2020
% Md. Humayun Kabir

clc
close all
clear all
% Message signal input and ploting

n=[1 0 1 0]; % Message signal in binary form


N=length(n); % Length of message signal
fs = 1000*N; % Sampling frequency
t=0:1/fs:N; % Time division with step b
N1=length(t); % Length of total divisions
i=1;

%Run for Loop


for j=1:N1
if t(j)<=i
x(j)=n(i);
else
i=i+1;
end
end
figure(1);
subplot(3,2,1);
plot(t,x,'Linewidth',2); %Message signal plot
title('Message signal');
xlabel('Time');
ylabel('Amplitude');
grid on

%Carrier signals generation (x1,x2)

a=2; %Amplitude scale for carrier signal


f1=10; %1st carrier signal frequency
f2=5; %2nd carrier signal frequency

% Uncomment the following for user input

x1=a*sin(2*pi*f1*t); %1st carrier signal


subplot(3,2,2);
plot(t,x1); %1st carrier signal plot
title('1st carrier signal');
xlabel('Time');
ylabel('Amplitude');
grid on
x2=a*sin(2*pi*f2*t); %2nd carrier signal
subplot(3,2,3);
plot(t,x2); %2nd carrier signal plot
title('2nd carrier signal');
xlabel('Time');
ylabel('Amplitude');
grid on

%Modulation section

for j=1:N1
if x(j)==1
y1(j)=x1(j);
else
y1(j)=x2(j);
end
end
subplot(3,2,4);

%Plot of FSK output signal

plot(t,y1);
title('Modulated FSK output');
xlabel('Time');
ylabel('Amplitude');
grid on

%FSK Receiver section

for j=1:N1
if y1(j)==x1(j)
y2(j)=1;
else
y2(j)=0;
end
end
subplot(3,2,5);

%Plot of FSK demodulated signal


plot(t,y2,'Linewidth',2);
title('Demodulated FSK signal');
xlabel('Time');
ylabel('Amplitude');
grid on

Output

You might also like