University School of Automation & Robotics

Personal resource archive for various courses.

4.m

%fm modulation and demodulation
close all
clear all
clc
fs=10000;
Am=1;
Ac=1;
fm=35;
fc=500;
B=10;
t=(0:.1*fs)/fs;
wc=2*fc*pi;
wm=2*fm*pi;
m_t=Am*cos(wm*t);
subplot(4,1,1)
plot(t,m_t);
title('Message Signal m(t)');
xlabel('Time (s)');
ylabel('Amplitude');
c_t=Ac*cos(wc*t);
subplot(4,1,2)
plot(t, c_t);
title('Carrier Signal c(t)');
xlabel('Time (s)');
ylabel('Amplitude');
s_t=Ac*cos(wc*t + B*sin(wm*t));
subplot(4,1,3)
plot(t, s_t);
title('FM Modulated Signal s(t)');
xlabel('Time (s)');
ylabel('Amplitude');
d=demod(s_t,fc,fs,'fm');
subplot(4,1,4)
plot(t, d);
title('Demodulated Signal d(t)');
xlabel('Time (s)');
ylabel('Amplitude');
sgtitle('Sujal Singh (04119051723)')