0% found this document useful (0 votes)
390 views8 pages

Matlab Code for FM Signal Processing

FREQUENCY MODULATION BY VARACTOR MODULATOR AND FREQUENCY DEMODULATION BY FOSTER-SEELEY DETECTOR matlab codes

Uploaded by

MdMorshedulHaque
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
390 views8 pages

Matlab Code for FM Signal Processing

FREQUENCY MODULATION BY VARACTOR MODULATOR AND FREQUENCY DEMODULATION BY FOSTER-SEELEY DETECTOR matlab codes

Uploaded by

MdMorshedulHaque
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Matlab code:

%% message signal
close all
clear all
clc
ts = 1.e-4;
t = -0.04 : ts : 0.04;
Ta = 0.005;
%m_sig = triangularPulse((t+0.01)/Ta) - triangularPulse((t-0.01)/Ta);
m_sig = 10 * square(2*pi*(1/Ta)*t);
figure(1)
plot(t,m_sig);
title('message signal')
%% frequency domain representation
Lfft = length(t);
Lfft = 2^ ceil(log2(Lfft));
M_fre=fftshift(fft(m_sig,Lfft));
freqm = (-Lfft/2 : Lfft/2-1)/ (Lfft*ts);
figure(2)
plot(freqm, abs(M_fre))
title('message signal in frequency domain')
%% frequency modulation
B_m = 100;
h=fir1(80, [B_m*ts]);
kf = 160*pi;
m_intg = kf *ts *cumsum(m_sig);
s_fm = cos(2*pi*300*t+m_intg);
figure(3)
plot(t, s_fm)
size(s_fm)
title('FM signal output')
%% demodulation
s_fmdem = diff([s_fm(1) s_fm])/ts/kf;
s_fmrec = s_fmdem.*(s_fmdem>0);
s_dec = filter(h,1,s_fmrec);
figure(5)
plot(t, s_fmdem)
title('FM derivative')
figure(6)
plot(t, s_fmrec)
title('rectified FM derivative')
%%
Lfft = length(t); Lfft = 2^ceil(log2(Lfft)+1);
s_fm = fftshift(fft(s_fm, Lfft));
freqs = (-Lfft/2 : Lfft/2-1)/(Lfft*ts);
figure(4)
plot(freqs, abs(s_fm))
title('FM signal output in frequency domain')

Impact of change of amplitude of message signal (freq = 100hz) :


Amplitude = 5 unit

Amplitude = 10 unit

Impact of change of frequency (freq = 200, amplitude = 10 unit)

FM demodulation : (freq =200, amp =10)

You might also like