1

I'm attempting this matlab code but I keep getting an error. Any hints?

%Frequency Demodulation
f_fmCarrier=1000; %frequency of FM carrier signal
f_sampling=f_fmCarrier*2; %frequency of sampling
recordFmModulatedSignal=audiorecorder(f_sampling,16,1,1);
recordblocking(recordFmModulatedSignal,5);
rFmModulatedSignal=getaudiodata(recordFmModulatedSignal);
figure(2)
subplot(3,1,1);
plot(rFmModulatedSignal,'b');
title('Recieved FM Modulated signal');
xlabel('Seconds');
ylabel('Amplitude');
fmMessageSignal=fmdemod(rFmModulatedSignal,f_fmCarrier,f_sampling,mod_index*f_fmMessageSignal);
subplot(3,1,2);
plot(fmMessageSignal,'r');
title('Demodulated signal by using fmdemod command');
xlabel('Seconds');
ylabel('Amplitude');
B_fm=fir1(401,2*(f_fmMessageSignal/f_sampling));% lowpass filter of order 401 & frequency
fmMessageSignal2=filter(B_fm,1,fmMessageSignal);
subplot(3,1,3);
plot(fmMessageSignal2,'m');
title('Demodulated signal by using a lowpass filter');
xlabel('Seconds');
ylabel('Amplitude');

error:

Undefined function 'fmdemod' for input arguments of type 'double'.

Error in project2 (line 32)
fmMessageSignal=fmdemod(rFmModulatedSignal,f_fmCarrier,f_sampling,mod_index*f_fmMessageSignal);
Sony Mathew
  • 2,929
  • 2
  • 22
  • 29
Josh
  • 11
  • 2

1 Answers1

1

fmdemod is not a built-in function in MATLAB, hence the error. Specifically, it is located in the Communications System Toolbox, which it appears you don't have.

You'll need to write your own or find an implementation that conforms to the interface that your above snippet requires. Here is online documentation for the version in the toolbox.

Jason R
  • 11,159
  • 6
  • 50
  • 81
  • the function is in matlab library......http://www.mathworks.com/help/comm/ref/fmdemod.html – Josh May 12 '15 at 12:18
  • 1
    if you look, you see the words "Communications System Toolbox Documentation" at the bottom.. You need the toolbox. – hiandbaii May 12 '15 at 13:23