Exp 6
Exp 6
Frequency Modulation
Frequency Modulation (FM) is a type of modulation in which the frequency of the carrier signal
is varied in proportion to the amplitude of the modulating signal. In contrast to Amplitude
Modulation (AM), where the amplitude of the carrier signal is varied in proportion to the amplitude
of the modulating signal.
FM has several advantages over AM, some of them are:
1. Improved signal-to-noise ratio: FM is less sensitive to noise and interference than AM, which
makes it more resistant to noise and interference.
2. Better sound quality: FM provides better sound quality than AM because it is less affected by
noise and distortion.
3. Greater dynamic range: FM can transmit signals with a wider dynamic range than AM, which
allows for a greater range of volume levels.
4. Greater immunity to fading: FM is less affected by fading caused by atmospheric conditions
than AM, which makes it more reliable over long distances.
5. Greater efficiency: FM is more efficient than AM because it uses less power to transmit the
same amount of information.
In conclusion, FM is a type of modulation that varies the frequency of the carrier signal in
proportion to the amplitude of the modulating signal. It has several advantages over AM, such as
improved signal-to-noise ratio, better sound quality, greater dynamic range, greater immunity to
fading, and greater efficiency. However, FM also has some disadvantages, such as greater
bandwidth requirements, more complexity, and greater sensitivity to frequency drift.
Fm Modulation/Demodulation example:
clc;clear all
% Define the message signal
fs = 10000; % sample rate
t = 0:1/fs:1; % time vector
f_m = 5; % frequency of message signal
m = cos(2*pi*f_m*t); % message signal
% Define the carrier signal
f_c = 50; % frequency of carrier signal
% Define the modulation index
beta = 0.5;
% Perform FM modulation
y_mod = fmmod(m,f_c,fs,beta);
% Perform FM demodulation
y_demod = fmdemod(y_mod,f_c,fs,beta);
% Plot the signals in time domain
figure;
subplot(3,1,1);
plot(t,m);
title('Message signal');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(3,1,2);
plot(t,y_mod);
title('FM modulated signal');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(3,1,3);
plot(t,y_demod);
title('FM demodulated signal');
xlabel('Time (s)');
ylabel('Amplitude');
% Plot the signals in frequency domain
figure;
subplot(3,1,1);
plot(fftshift(abs(fft(m))));
title('Message signal');
xlabel('Frequency (Hz)');
ylabel('Amplitude');
subplot(3,1,2);
plot(fftshift(abs(fft(y_mod))));
title('FM modulated signal');
xlabel('Frequency (Hz)');
ylabel('Amplitude');
subplot(3,1,3);
plot(fftshift(abs(fft(y_demod))));
title('FM demodulated signal');
xlabel('Frequency (Hz)');
ylabel('Amplitude');
This code is demonstrating an example of Frequency Modulation (FM) using MATLAB. It starts
by defining the message signal, carrier signal, and modulation index.
1. First, it sets the sampling frequency 'fs' and the time vector 't' and generates the message signal
by creating a cosine wave with the frequency of message signal 'f_m' and 't'.
2. Then, it sets the frequency of carrier signal 'f_c' and modulation index 'beta'.
3. Next, it uses the 'fmmod' function to modulate the message signal 'm' using the carrier signal
'f_c' with the sample rate 'fs' and the modulation index 'beta'. The output of this step is the FM-
modulated signal 'y_mod'.
4. Then it uses the 'fmdemod' function to demodulate the FM modulated signal 'y_mod' using the
carrier signal 'f_c' with the sample rate 'fs' and the modulation index 'beta'. The output of this step
is the demodulated signal 'y_demod'
5. Next, it plots the original message signal, FM modulated signal, and demodulated signal in the
time domain, using the 'plot' function.
6. Finally, it plots the original message signal, FM modulated signal, and demodulated signal in
the frequency domain, using the 'fftshift' and 'fft' functions to shift the frequency spectrum and
calculate the FFT respectively.
This code demonstrates how to modulate and demodulate a message signal using FM, and how to
visualize the original and modulated signals in both time and frequency domains. This is a good
way of understanding the concept of FM modulation and how it differs from AM modulation.
clc;clear;close all
fs = 1000;
fc = 200;
t = (0:1/fs:0.1)';
x = sin(2*pi*30*t)+2*sin(2*pi*60*t);
fDev = 50;
int_x = cumsum(x)/fs;
xfm = cos(2*pi*fc*t).*cos(2*pi*fDev*int_x)- sin(2*pi*fc*t).*sin(2*pi*fDev*int_x) ;
xi=cos(2*pi*fDev*int_x);
xq=sin(2*pi*fDev*int_x) ;
t2 = (0:1/fs:((size(xfm,1)-1)/fs))';
t2 = t2(:,ones(1,size(xfm,2)));
xfmq = hilbert(xfm).*exp(-j*2*pi*fc*t2);
z = (1/(2*pi*fDev))*[zeros(1,size(xfmq,2)); diff(unwrap(angle(xfmq)))*fs];
figure(1)
subplot(211)
plot(t,x)
subplot(212)
plot(t,xfm)
figure(2);
plot(t,x,'c',t2,z,'b--');
xlabel('time ');
ylabel('amplitude');
legend('Original Signal','Demodulated Signal');grid on
Post Lab