我正在尝试这个matlab代码,但我一直收到错误。任何提示?
%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');
错误:
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);
答案 0 :(得分:1)
fmdemod
不是MATLAB中的内置函数,因此是错误。具体来说,它位于通信系统工具箱中,它似乎没有。
您需要自己编写或找到符合上述代码段所需界面的实现。 Here is online documentation for the version in the toolbox