MATLAB Coder for FSK Demodulation

8 ビュー (過去 30 日間)
mounika
mounika 2019 年 9 月 23 日
コメント済み: mounika 2019 年 9 月 25 日
Hello,
I am trying to generate c code for FSK Modulation and Demodulation. Following is my function for code generation:
function [modSignal,receivedData,errorStats] = test_my_FSK(data)
%#codegen
M = 4;
freqSep = 100;
fskMod_M = comm.FSKModulator(M,freqSep,'BitInput',true);
fskDemod_M = comm.FSKDemodulator(M,freqSep,'BitOutput',true);
err = comm.ErrorRate;
modSignal = zeros((fskMod_M.SamplesPerSymbol*(length(data)/2)),1)+0i;
receivedData = zeros(length(data),1);
errorStats = zeros(3,1);
for counter = 1:10
modSignal = step(fskMod_M,data);
receivedData = step(fskDemod_M,modSignal);
errorStats = step(err,data,receivedData);
end
end
In the above function, you can observe that I have both FSK modulation and Demodulation. I have no issues converting the modulation part into mex, but when it comes to demodulation it throws the following error:
Matlab Coder Error.JPG
I was successful in generating mex for just the modulation part, only when I include the demodulation part it fails. Kindly advise.
Also, I observed that,
class for FSK Modulation :
FSK_Mode_Class_Type.JPG
Whereas that of the demodulator is,
demod_type.JPG
I have checked MATLAB documentation for comm.FSKDemodulator, it says it is supported for C code generation.
Your help will be greatly appreciated. Kindly advise
  2 件のコメント
Denis Gurchenkov
Denis Gurchenkov 2019 年 9 月 24 日
This looks like a bug. Can you please attach all the files you have been using (the .m file and .prj file) and also specify what release of MATLAB you are using and what platform?
mounika
mounika 2019 年 9 月 24 日
編集済み: mounika 2019 年 9 月 24 日
Hi Denis,
Couldn't attach the .prj file (It says unsupported format).
Attached the .m file and the test file
MATLAB 18b, Win64
Kindly suggest any other alternate way to do this code generation.
Also, does M-FSK modulator & demodulator block support code generation for C in Simulink

サインインしてコメントする。

採用された回答

Vivek Selvam
Vivek Selvam 2019 年 9 月 24 日
Hi Mounika,
Code generation is successful when using Name-Value pairs for comm.FSKDemodulator as follows:
fskDemod_M = comm.FSKDemodulator('ModulationOrder',M,'FrequencySeparation',freqSep,'BitOutput',true);
The equivalent Simulink blocks (M-FSK Modulator Baseband and M-FSK Demodulator Baseband) support C code generation:
>> web(fullfile(docroot, 'comm/ref/mfskmodulatorbaseband.html'))
>> web(fullfile(docroot, 'comm/ref/mfskdemodulatorbaseband.html'))
Thanks for reporting this bug.
/Vivek
  1 件のコメント
mounika
mounika 2019 年 9 月 25 日
Thanks a lot Vivek. That solved my issue.
Best Regards,
Mounika

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFSK についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by