Chapter 10

Prototyping as C/C++ Code

So far we have developed MATLAB® programs and Simulink models in order to simulate the LTE (Long Term Evolution) PHY (Physical Layer) in the MATLAB environment. At some stage in the workflow of a communications system design, we might need to produce a software component that cannot be directly simulated in MATLAB. For example, we might need to interface to an existing simulation environment based on a C/C++ software implementation. If we want to export the result of modeling and simulation in MATLAB to an external C/C++ programming environment, we essentially have two choices: we can either manually translate algorithms developed in MATLAB into a C or C++ implementation or we can take advantage of automatic MATLAB C-code generation.

By using MATLAB Coder, we can generate standalone C and C++ code from MATLAB code. The generated source code is portable and readable. MATLAB Coder supports a subset of MATLAB language features, including program control constructs, functions, and matrix operations. It can generate MATLAB executable (MEX) functions that let us accelerate computationally intensive portions of MATLAB code and verify its behavior. It can also generate C/C++ source code for integration with existing C code, creation of an executable prototype, or direct implementation on a Digital Signal Processor (DSP) or general-purpose CPU using a C/C++ compiler.

In this chapter we examine the process of generating standalone C and C++ code from ...

Get Understanding LTE with MATLAB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.