University of Engineering and Technology Lahore (Narowal Campus) Experiment No. 9 Frequency Modulation & Demodulation Using MATLAB

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

University of Engineering and Technology Lahore (Narowal Campus)

EXPERIMENT NO. 9
Frequency Modulation & Demodulation Using MATLAB

OBJECTIVE
In this lab, we shall use MATLAB to implement frequency modulation and demodulation

DESCRIPTION
Let us consider a sinusoidal message signal of 10 Hz and a sinusoidal carrier in the transmitter of
400 Hz and frequency deviation 100Hz, carrier amp: 1Vpp.

1. Write Matlab code to generate FM signal


2. Plot the FM signal and the message signal on same graph
3. Write Matlab code to find the frequency spectrum of the FM and message signal
4. Plot the amplitude response of FM signal and the message signal on same graph
5. Write Matlab code to implement the Envelop Detector for C= 1uF and R=[3000 300
30 3] K-Ohm. What happen to the signal?
6. Plot the output of the Envelop Detector for each case. What happen to the signal?
What is the best choice of RC?
7. Repeat the above simulation with a square wave signal as the message signal.

MATLAB Program

%%FM Modulation
fc=20;
fm=1;
ts=1/(10*fc);
fs=1/ts;
kf=2;
wc=2*pi*fc;
t=0:ts:2;
m=sin(2*pi*fm*t);
m_int=-2*pi*cos(2*pi*fm*t);
y=cos(wc*t+(kf*m_int));
figure(1);
subplot(211);
plot(t,m);
title('Input Signal');
subplot(212);
plot(t,y);
title('FM modultion of Input Signal');

%% Spectrum of FM signal

mf=fftshift(fft(m))*ts;
delta=fs/length(mf);
f=-fs/2:delta:fs/2-delta;
figure(2);
subplot(211);
plot(f,abs(mf));
title('Magnitude spectrum of Input Signal');
a=fftshift(fft(y))*ts;
delta=fs/length(a);
f=-fs/2:delta:fs/2-delta;
subplot(212);
University of Engineering and Technology Lahore (Narowal Campus)
plot(f,abs(a));
title('Magnitude spectrum of FM Signal');

%%% Differentiator
E=diff(y)/ts;
figure(3);
plot(E);
title('Differentiation of FM signal');

%%% Envelop Detection


%% Plot the output of Envelop Detector for different values of 'R'
vout(1)=E(1);
t1=(0:length(E)-1)*ts;
R=[10^6;10^5;10^4;10^3]*3;
C=10^-6;
for n=1:4
for i=2:length(E)
if E(i) >vout(i-1)
vout(i)=E(i);
else
vout(i)=vout(i-1).*exp(-ts/(R(n)*C));
end
end

figure(4);
subplot(4,1,n);
plot(t1,vout,t1,E);

title('Output of Envelop Detector');


RC=R(n)*C
end
University of Engineering and Technology Lahore (Narowal Campus)

EXPERIMENT NO. 10
Phase Modulation and Demodulation Using Matlab
OBJECTIVE
To write and simulate a MATLAB program to generate a phase modulated signal and then demodulate it.

DESCRIPTION

1. To generate message and carrier signal, initialize:


 fc(carrier frequency),
 fm(modulating signal frequency),
 t(time axis)
2. Generate message signal as Sin(2πfmt)
3. Generate carrier signal as sin(2πfct).
4. Generate the frequency modulated signal using the FM equation Sin[2πfc*t+ mf*
Sin(2πfm*t) ] where mf stands for modulation index. Choose modulation index value more than
1.
5. Plot all the signals

MATLAB Program

clc;
clear all;
close all;
fm=25;
fc=400;
mf=10;
t=0:0.0001:0.1;
m=sin(2*pi*fm*t);
subplot(3,1,1);
plot(t,m);
xlabel('Time(s)');
ylabel('Amplitude(V)');
title('Message Signal');
grid on;

c=sin(2*pi*fc*t);
subplot(3,1,2);

plot(t,c);
xlabel('Time(s)');
ylabel('Amplitude(V)');
title('Carrier Signal');
grid on;

y=sin(2*pi*fc*t+(mf.*sin(2*pi*fm*t)));%Frequency changing w.r.t Message signal


subplot(3,1,3);
University of Engineering and Technology Lahore (Narowal Campus)
plot(t,y);
xlabel('Time(s)');
ylabel('Amplitude(V)');
title('Frequency modulated Signal');
grid on;

Lab Tasks

1) Write a MATLAB program to demodulate the PM signal and compare it with your message signal
on the same plot
University of Engineering and Technology Lahore (Narowal
Campus)

EXPERIMENT NO. 11
FM Modulation using PLL

Laboratory Tasks
In this Laboratory exercise you will generate a single-tone modulated FM signal using the Voltage-
controlled Oscillator (VCO) in a Phase-locked loop (PLL)

Background
Figure 1 shown below uses the VCO portion of the 4046 PLL.

The frequency deviation constant in FM i.e. 𝑘𝑓 can be determined for the above circuit by plotting
the VCO’s output frequency versus the VCO’s input voltage. This should give (approximately) a
straight line, its slope is 𝑘𝑓 in hertz-per-volt. The formula for modulation index for FM i.e. 𝛽𝑓 is
given in Chapter 4 of the text (by J. G. Proakis & M. Salehi 2014)

1. Investigate the above circuit by giving it different inputs through the circuit as shown in
Figure 2.
2. Find the frequency for the three VCO input voltages as shown in the table of Figure 2. From
that information, determine 𝑘𝑓 for your modulator.
3. Now apply a sinusoidal signal of 5 KHz with an amplitude of 2 Volts peak to peak and DC
offset of 5 Volts at the input of VCO. Determine 𝛽𝑓 of your signal.

5
University of Engineering and Technology Lahore (Narowal
Campus)

4. Show the time domain output of the VCO to the instructor. Essentially it is a rectangular
waveform with a varying frequency.
5. Write a brief summary of the background and calculations about using PLL circuit for FM
generation.

Figure 2

6
University of Engineering and Technology Lahore (Narowal
Campus)

EXPERIMENT NO. 12
FM Demodulation using PLL
Laboratory Tasks
In this Laboratory exercise you will demodulate a frequency modulated signal using PLL which
you have generated in lab#11.

Background
Figure 1 shows the frequency modulation and demodulation circuit.

Figure 1: Frequency modulation and demodulation circuit

1. Perform all steps given in previous lab#12 manual to generate the Frequency modulated
signal.
2. First PLL IC CD4046 is used for FM modulation and second CD4046 is used for
demodulation of FM modulated signal.
3. Build the circuit shown in Figure 1 for FM modulation and demodulation. It is not necessary
to use the buffer and output low pass filter.
4. Show the demodulated signal to the instructor.
5. Write a brief summary of the background and calculations about using PLL circuit for FM
demodulation.

You might also like