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
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