What are the steps to reproduce the plots in 5G New Radio Polar Coding example?

3 次查看(过去 30 天)
The plot presented as an example for 5G New Radio Polar Coding in the following link:
states that the results were produced by encapsulating the code presented in that page into a function that supports C-code generation.
I would like to know what were the intermediary steps that were used. Is it that C-code was generated and it is called in MATLAB or the code was run in C and saved data is used in MATLAB to plot it?
In my work as well I most often do simulations to produce BER plots, I would like to adopt similar methodology, so that I can speed up the executions. It would be helpful if someone puts in steps that can recreate the plots in that example using C-code generation.

采纳的回答

Konstantinos Athanasiou
A fitting workflow to speed up the execution time of this example (and produce similar plots quickly) could be:
1. Encapsulate the code into a function for code generation by puting the script's code in a function, say:
function bler = computeBLER
% the script's code here
bler = numferr/numFrames;
end
2. Use MATLAB coder and its codegen function (https://www.mathworks.com/help/coder/generating-code.html) to generate the MEX function computeBLER_mex
>> codegen computeBLER
3. Call computeBLER_mex from other matlab scripts/function to gather the results and plot them as needed.
  2 个评论
Zakir Hussain Shaik
Zakir Hussain Shaik 2022-10-20
编辑:Zakir Hussain Shaik 2022-10-20
Thank you for your quick response and for telling me the workflow required. I have tried following the steps stated for the polar coding example. But I get runtime issues with nrPolarDecode() function. On the other hand there seems no problem with nrPolarEncode().
I have attached the function file
  • computepolarcodeBLER.m for c code generation
  • Example1.m which calles the above function. This example runs without any issue. However, mex generation of the function has issues.
Can you let me know how to circumvent this issue? I don't have control over that function as that is an inbuilt function, and the documentation of the function https://se.mathworks.com/help/5g/ref/nrpolardecode.html states it supports C/C++ code generation. I am using MATLAB 2021b version.
Thanks,
Zakir
Zakir Hussain Shaik
Zakir Hussain Shaik 2022-10-20
编辑:Zakir Hussain Shaik 2022-10-24
I have now put up all the variables except K, E and SNR for the above example within the function itself instead of being them as a varying parameters. Seems now that is working. I have now able to create a mex file and use it in the example code.
Thanks for the help.
Regards,
Zakir

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Coder 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by