how can i do frequency demodulation in matlab
i have already done frequency modulation, but i can't do frequency demodulation this is matlab code
clear all
close all
recorder = audiorecorder(44100,16,1);
recordblocking(recorder,2);
xtmessage = getaudiodata(recorder);
time=(1/44100)*length(xtmessage);
t=linspace(0,time,length(xtmessage));
xt=xtmessage/max(abs(xtmessage)); %normalization
Ac=2; %amplitude
fc=10000; %carrier frequency
Df= 6000; % frequency deviation
variant = 0;
for n=1:88200;
variant = variant + xt(n);
xct(n) = Ac*cos(2*pi*fc*n/44100 + 2*pi*Df*variant/88200);
end
Xft = fft(xct);
Xft = fftshift(Xft);
plot(abs(Xft))
You could use fmmod() and fmdemod(). This is the link for documentation of fmdemod function