Professional Documents
Culture Documents
Lab Report-03:
Title: Amplitude Modulation/Demodulation in MATLAB
FA20-BEE-010
Registration Number FA20-BEE-048
BEE-5B
Class/Section
Pre Lab /1
/1
Ability to use software /5
Follow procedures /5 /10
In Lab
Troubleshoot software /5 /5
Q&A /5
Presentation /4
Post-Lab Analysis /4 /4
Writing /4
In Lab Tasks
Task 3.1
Generate the following message signal. Plot the time-domain waveform of the message
signal and analyzeits spectrum. Set 𝑡𝑡0 = 0.15.
Lab 03 2
MATLAB Code and Results:
clc;
clear all
close all;
t0=0.15;
step=0.0005;
tx1=0:step:0.05;
tx2=0.05:step:0.1;
t=[tx1 tx2];
m1=ones(size(tx1)).*1;
m2=ones(size(tx2)).*(-2);
m=[m1 m2];
subplot(2,1,1)
plot(t,m,'linewidth',2)
title('Message signal in time domain')
xlabel('t')
ylabel('m')
grid on;
L=length(m);
m3=abs(fft(m,L));
U = fftshift(fft(m));
w=1000*linspace(-1,1,L);
subplot(2,1,2)
plot(w,m3,'linewidth',2)
title('Message signal in Frequency Domain')
xlabel('w')
ylabel('m3')
grid on;
Lab 03 3
RESULT:
Figure 1:shows the message signal in time domain as well as frequency domain.
Task 3.2
Perform DSB-SC AM on the message signal generated in the Task 3.1. Plot the time-domain
waveform of the modulated signal and analyse its spectrum. For the carrier signal assume that 𝐴𝐴
= 1 volts and 𝑓𝑓𝑐𝑐 = 250 Hz.
Lab 03 4
MATLAB Code:
clc;
clear all
close all;
t0=0.15;
step=0.0005;
tx1=0:step:0.05;
tx2=0.05:step:0.1;
t=[tx1 tx2];
m1=ones(size(tx1)).*1;
m2=ones(size(tx2)).*(-2);
m=[m1 m2];
subplot(2,1,1)
plot(t,m,'linewidth',2)
title('Message signal')
xlabel('t')
ylabel('m')
grid on;
L=length(m);
m3=abs(fft(m,L));
w=1000*linspace(-1,1,L);
subplot(2,1,2)
plot(w,m3,'linewidth',2)
title('Message signal in Frequency Domain')
xlabel('w')
ylabel('m3')
grid on;
figure(2)
f=250;
AC=1;
y=cos(2*pi*f*t);
plot(t,y,'linewidth',2)
title('carrier')
figure(3)
g= AC*m.*y;
subplot(2,1,1)
plot(t,g,'linewidth',2)
title('Modulated Signal in Time Domain')
xlabel('t')
Lab 03 5
ylabel('g')
grid on;
L=length(g);
g=abs(fft(g,L));
U = fftshift(fft(g));
w=1000*linspace(-1,1,L);
subplot(2,1,2)
plot(w,g,'linewidth',2)
title('Modulated signal in Frequency Domain')
xlabel('w')
ylabel('u')
RESULTS:
Lab 03 6
Lab 03 7
Task 3.3
Perform the coherent demodulation on the modulated signal of the Task 3.2. Determine
appropriate cut-off frequency of the low-pass filter to recover message signal. Plot the time-
domain waveform of the recovered signaland its spectrum.
clc;
clear all;
close all;
Ac = 1;
Fc= 250;
t0=0.15;
Fs=1000;
step=0.0005;
tx1=0:step:0.05;
tx2=0.05:step:0.1;
t=[tx1 tx2];
m1=ones(size(tx1)).*1;
m2=ones(size(tx2)).*(-2);
m=[m1 m2];
u = Ac.*m.*cos(2*pi*Fc*t)
subplot(3,1,1)
plot(t,u,'linewidth',2)
title('Modulated Signal')
c = (Ac.*m.*cos(2*pi*Fc*t)).*(Ac.*cos(2*pi*Fc*t));
subplot(3,1,2)
plot(t,c,'linewidth',2)
title('U(t)*Carrier Signal')
y= Fc./Fs;
lpf=fir1(15,y);
demod=filter(lpf,1,c)
subplot(3,1,3)
plot(t,demod,'linewidth',2)
title('Demodulated Signal')
Lab 03 8
RESULT:
Figure 2:shows the modulated signal and if we take product of carrier with modulated signal it
will give back a demodulated signal which is a message signal.
Task 3.4
Perform the DSB-TC AM on the message signal generated in the Task 3.1. Using the modulation
index value of
𝜇𝜇 = 0.5, set the appropriate value of 𝐴𝐴. Plot the time-domain waveform of the modulated signal
and analyse its spectrum.
Lab 03 9
MATLAB Code:
clc;
clear all;
close all;
t0 = 0.15;
step = 0.0005;
tx1 = 0:step:0.05;
tx2 = 0.05:step:0.1;
t = [tx1 tx2];
m1 = ones(size(tx1)) * 1;
m2 = ones(size(tx2)) * (-2);
m = [m1 m2];
Lab 03 10
grid on;
figure;
subplot(2,1,1)
plot(w, abs(U), 'linewidth', 2)
title('Modulated Signal in Frequency Domain (Magnitude)')
xlabel('w')
ylabel('|U(w)|')
grid on;
subplot(2,1,2)
plot(w, angle(U), 'linewidth', 2)
title('Modulated Signal in Frequency Domain (Phase)')
xlabel('w')
ylabel('Phase(U(w))')
grid on;
RESULT:
Lab 03 11
Figure 3: This graph shows the effect of changing modulation constant and also changing the
amplitude of carrier signal.
Post-Lab Task
Import an audio signal ‘afile.wav’ in MATLAB. Plot the time-domain waveform of the
message signal andanalyze its spectrum.
Setting 𝐴𝐴 = 1 volts and 𝑓𝑓𝑐𝑐 = 15000 Hz, perform the DSB-SC AM on the audio file. Plot
the time-domainwaveform of the modulated signal and analyse its spectrum.
Perform the coherent demodulation on the modulated audio signal. Determine appropriate
cut-off frequency of the low-pass filter to recover message signal. Plot the time-domain
waveform of the recoveredsignal and its spectrum.
Note: use the MATLAB function ‘soundsc’ to listen to the original and recovered audio signal.
Lab 03 12
MATLAB CODE:
Lab 03 13
title('Modulated Signal in Time Domain'); % Sets the title
for the subplot
Lab 03 14
RESULT:
Lab 03 15
Explanation:
It demonstrates the modulation and demodulation of an audio signal using amplitude modulation
(AM). It takes an audio signal from the file 'afile.wav', modulates it with a carrier signal, and
then demodulates it to recover the original message signal. The code also includes various
plotting and visualization steps to show the signals in the time and frequency domains.
Critical Analysis
4. AM Modulation:
The core of this lab exercise is the modulation process. The original audio signal is combined with the
carrier signal using multiplication (`modulated signal = audio .* carrier'`).The result is a modulated signal
that carries the information from the original audio within its amplitude variations. Plotting the modulated
signal in the time domain enables students to observe how the audio signal is embedded within the carrier.
6. Coherent Demodulation:
Coherent demodulation involves reversing the modulation process by multiplying the modulated signal
with the carrier signal. This step extracts the original audio signal from the modulated signal, a critical
concept in demodulation.
Lab 03 16