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

3 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

Konstantinos Athanasiou
Konstantinos Athanasiou le 19 Oct 2022
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 commentaires
Zakir Hussain Shaik
Zakir Hussain Shaik le 20 Oct 2022
Modifié(e) : Zakir Hussain Shaik le 20 Oct 2022
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 le 20 Oct 2022
Modifié(e) : Zakir Hussain Shaik le 24 Oct 2022
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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Coder dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by