Checklist

This guide will help you speed up your simulations and improve the performance of your Simulink® model(s). The steps below point you to some tools that you can use, based on your situation, for fixing or analyzing the performance of your model(s). Please contact Technical Support if you have any issues performing these steps or if you can’t resolve your issue. The steps ask you to collect the data as you move through them. This data will help Technical Support understand your problem faster on the off chance that you need additional support.

Step 1: Consider Recent Changes

Did changing your model or MATLAB release cause a performance issue?

Step 2: Run the Performance Advisor

The Performance Advisor analyzes the model for configuration settings and modeling patterns that can slow down simulation and suggests actions to improve performance. After making modifications to the model, the Performance Advisor can do a final validation to show the improvements made.

Once the Advisor has done the final validation, save the report.

If you want to try additional techniques to improve performance, proceed to Step 3.

Step 3: Initialization Profiling

Do you have a SimulationOutput object with results from a recent simulation?

Use the MATLAB Profiler to look for code that may be slowing down initialization.

MATLAB Profiler

Sometimes, there are model callbacks or initialization scripts that have a large MATLAB code base. The MATLAB Profiler analyzes the time it takes to execute the MATLAB code associated with your model to help you identify potential bottlenecks.

Run these commands in the Command Window before running the simulation:
profile clear; profile on;

After the simulation is complete, run this command:
p = profile('info');

After the MATLAB Profiler runs, click on Print and save the report as a PDF.

Look at the results of profiler. If there are functions or scripts that you did not expect, or if the execution of some MATLAB code is taking longer than you expect, take some time to try to fix it.

If you want to try additional techniques to improve performance, proceed to Step 4.

Step 4: Simulation Profiling

Are you using a variable-step solver?

If you are not sure, look at the Solver pane in the Configuration Parameters dialog box.

Step 5: Further Steps

Are you satisfied with the performance of your model?