# Problem with FM Modulation

Discussion in 'Programmer's Corner' started by ashwini1, Aug 12, 2009.

1. ### ashwini1 Thread Starter New Member

Aug 1, 2009
9
0
Hi,

I am facing problem with fm modulation and demodulation.
i want to design a fm modulation with the following specs:

fm = modulating freq = 30Hz
fc = carrier freq = 10kHz
dev = frequency deviation = 480Hz
The problem is that for the carrier freq more than 1kHz, is not getting modulated properly which can be confirmed at demodulation.
Plz find below the matlab code:
-----------------------------------------------------------------------------------------------------------------------
fc=1e3;
Fs=10*fc;
t=(0:Fs)'/Fs;
L=1000;
fm=30;
ph=0;
dev=480;
NFFT=2^nextpow2(L);
f=Fs*linspace(0,1,NFFT);

%%---- FM ----%%
x=1*cos((2*pi*fc*t)-(dev/fm)*1*sin(2*pi*fm*t+(ph*pi/180)));

[num den]=butter(1,(fc+30+30)/(Fs/2)); % -3db @ 10Hz
x1 = filtfilt(num,den,x); % leave DC

%%---- FM DEMOD ----%%

yq = hilbert(x1).*exp(-j*2*fc*t);
y = (1/(2*pi*dev))*[zeros(1,size(yq,2)); diff(unwrap(angle(yq)))*Fs];

[num den]=butter(1,25/(Fs/2),'high');
y = filtfilt(num,den,y);

[num den]=butter(1,30/(Fs/2));
y = filtfilt(num,den,y);

figure;
subplot(211)
plot(t,y)

subplot(212)
plot(f,2*abs(fft(y,NFFT)/L))
axis([0 200 0 4])
-------------------------------------------------------------------------
Kindly go through the code and help me in debugging it.
Is there any constraint in selecting modulating frequency and carrier frequency.??

Thanks and Regards,
Ashwini

2. ### ashwini1 Thread Starter New Member

Aug 1, 2009
9
0
Few more doubts:
1) Is my method of demodulation is correct??? What are other ways where i can get back my original signal more faithfully.
2) Is there any constraint in selecting modulating frequency and carrier frequency??
3) How do i correlate Fs, fc, freqdev and fm.

Thanks !
Ashwini