Communication Lab Code Radio
Communication Lab Code Radio
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;
%% 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))
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
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;
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]);
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