Main Content

Model Performance Optimization

Performance improvements can help you achieve real-time execution. The following lists contain performance improvements you can make to models that contain the RTL-SDR Receiver block.


Run your application in Accelerator or Rapid Accelerator mode instead of Normal mode. Be aware that some scopes do not plot data when run in Rapid Accelerator mode.

When using accelerator or rapid accelerator mode, on the Model Configuration Parameters dialog box, search for Compiler optimization level to Optimizations on (faster runs).

Model Tuning

  • Use frame-based processing. With frame-based processing, the model processes multiple samples during a single execution call to a block. Consider using frame sizes from roughly 100 to several thousand.

  • In Model Configuration Parameters > Data Import/Export, turn off all logging.

  • The model must be single-rate. If the model requires resampling, then choose rational coefficients that keep the model single-rate.

  • Do not add any Buffer blocks to the model. If you want to create convenient frame sizes, do it in your data sources. Using a Buffer block typically degrades performance.

  • Avoid feedback loops. Typically, such loops imply scalar processing, which slows the model considerably.

  • Avoid using scopes. To visualize your data, send it to a workspace variable and post-process it.

  • If your model has Constant blocks with values that do not change during simulation, make sure that the sample time is set to inf (default).

Simulink Code Generation

  • If you are generating code from the model, set the Solver setting to Fixed-step/discrete. Set tasking mode to SingleTasking.

  • To improve performance, you can generate a standalone executable for your Simulink® model. The generated code runs without Simulink in the loop. To perform any code generation, you must have an appropriate compiler installed. See for compilers supported in the current release.

    You can generate generic real-time target (GRT) code if you have a Simulink Coder™ license. To do so, set Model Configuration Parameters > Code Generation > System target file to grt.tlc (Generic Real-Time Target).

  • When you select the option to generate code for any target (not just GRT), clear the Model Configuration Parameters > Hardware Implementation > Test hardware > Test hardware is the same as production hardware check box. Then, set the Device type to MATLAB Host Computer.

  • You can create generated code with a smaller stack than the GRT code if you have an Embedded Coder® license. To do so, set Model Configuration Parameters > Code Generation > System target file to ert.tlc (Embedded Coder). Then, add the following lines to the Model Configuration Parameters > Code Generation > Custom Code > Include custom C code in generated: > Source file:

    #include <stdio.h>
    #include <stdlib.h>

See Also


Related Topics