Jamalpur Science and Technology University
Department of Electrical and Electronic Engineering (EEE)
Course No: EEE 3212
Experiment no: 3
Experiment Name: FM COMMUNICATION USING MATLAB AND SIMULINK
PART A: FM COMMUNICATION USING MATLAB
Introduction:
The FM-modulated signal has its instantaneous frequency that varies linearly with the amplitude of the
message signal. Now we can get the FM-modulation by the following:
where kƒ is the sensitivity factor, and represents the frequency deviation rate as a result of message
amplitude change. The instantaneous frequency is:
The maximum deviation of Fc (which represents the max. shift away from Fc in one direction) is:
Program:
clear all;
close all;
clc;
%% Frequency MODULATION of Triangular Signal
t = -0.04:1.e-4:0.04;
Ta = 0.01;
fc = 200; % Frequency of carrier
msg = msg1(t,Ta); % Calling Function to Generate Msg Signal; find the code
in Appendix A
%% MODULATION
kf = 300*pi;
m_int = kf*1.e-4*cumsum(msg); % Integrating Msg
fm = cos(2*fc*pi*t + m_int); % fm = cos(2*pi*fc*t + integral(msg))
%% DEMODULATION (Using Differentiator)
dem = diff(fm);
dem = [0,dem];
rect_dem = dem.^2;
%% Filtering out High Frequencies
N = 80; % Order of Filter
Wn = 1.e-2; % Pass Band Edge Frequency.
Lab Sheet Credit
Shah Md Ashraful Alam Mohon & Rashid-Al-Mukaddim
Lecturer, Dept. of EEE, IUT Page 1
a = fir1(N,Wn); % Return Numerator of Low Pass FIR filter
b = 1; % Denominator of Low Pass FIR Filter
rec = filter(a,b,rect_dem);
%% Finding frequency Response of Signals
fl = length(t); % defining DFT (or FFT) size
fl = 2^ceil(log2(fl))% making fl a power of 2 since this makes the fft algorithm
work fast
f = (-fl/2:fl/2-1)/(fl*1.e-4);
mF = fftshift(fft(msg,fl));
% Frequency Response of Message Signal i.e. calculating the frequency domain
message signal, fft algorithm calculates points from 0 to fl-1, hence we use
fftshift on this result to order samples from -fl/2 to fl/2 -1
fmF = fftshift(fft(fm,fl)); % Frequency Response of FM Signal
rect_demF = fftshift(fft(rect_dem,fl)); % Frequency Response of Rectified FM Signal
recF = fftshift(fft(rec,fl)); % Frequency Response of Recovered Message Signal
%% Plotting signal in time domain
figure;
subplot(2,1,1);
plot(t,msg);
title('Message Signal');
xlabel('{\it t} (sec)');
ylabel('m(t)');
grid;
subplot(2,1,2);
plot(t,fm);
title('FM');
xlabel('{\it t} (sec)');
ylabel('FM');
grid;
figure;
subplot(2,1,1);
plot(t,rect_dem);
title('Rectified FM');
xlabel('{\it t} (sec)');
ylabel('dem')
grid;
subplot(2,1,2);
plot(t,rec);
title('Recovered Signal');
xlabel('{\it t} (sec)');
ylabel('m(t)');
grid;
%% Plotting Freq Response of Signals
figure;
subplot(2,2,1);
plot(f,abs(mF));
title('Freq Response of MSG');
Lab Sheet Credit
Shah Md Ashraful Alam Mohon & Rashid-Al-Mukaddim
Lecturer, Dept. of EEE, IUT Page 2
xlabel('f(Hz)');
ylabel('M(f)');
grid;
axis([-600 600 0 200]);
subplot(2,2,2);
plot(f,abs(fmF));
title('Freq Response of FM');
grid;
xlabel('f(Hz)');
ylabel('C(f)');
axis([-600 600 0 300]);
subplot(2,2,3);
plot(f,abs(rect_demF));
title('Freq Response of Rectified FM');
xlabel('f(Hz)');
ylabel('DSBSC(f)');
grid;
axis([-600 600 0 10]);
subplot(2,2,4);
plot(f,abs(recF));
title('Freq Response of Recovered Signal');
xlabel('f(Hz)');
ylabel('M(f)');
grid;
axis([-600 600 0 10]);
Lab Sheet Credit
Shah Md Ashraful Alam Mohon & Rashid-Al-Mukaddim
Lecturer, Dept. of EEE, IUT Page 3
PART B: FM COMMUNICATION USING SIMULINK
Simulink Model
Suggested FM Modulator for Simulation
Suggested FM Demodulator for Simulation
▪ Details will be discussed in the lab by the teacher
Lab Sheet Credit
Shah Md Ashraful Alam Mohon & Rashid-Al-Mukaddim
Lecturer, Dept. of EEE, IUT Page 4
Simulink Model using Built-in Simulink Block:
Appendix A:
% Function of Msg(tri)
function a = msg1(t,Ta)
t1 = -0.02:1.e-4:0;
t2 = 0:1.e-4:0.02;
m1 = 1 - abs((t1+Ta)/Ta);
m1 = [zeros([1 200]),m1,zeros([1 400])];
m2 = 1 - abs((t2-Ta)/Ta);
m2 = [zeros([1 400]),m2,zeros([1 200])];
a = m1 - m2;
end
Lab Sheet Credit
Shah Md Ashraful Alam Mohon & Rashid-Al-Mukaddim
Lecturer, Dept. of EEE, IUT Page 5