- Undocumented Matlab - https://undocumentedmatlab.com -

Improving Simulink performance

A few days ago I happened to speak with a colleague about Simulink run-time performance, and we discussed various ideas for simulation speed-up. This topic is very important to MathWorks, as evidenced by a dedicated documentation section [1], newsletter articles (1 [2], 2 [3]), webinars (1 [4], 2 [5], 3 [6], 4 [7]) and multiple blog posts [8] on improving simulation performance using the Simulink product.
This blog covers mainly the Matlab core product and closely-related toolboxes. However, since the various suggestions for improving performance are spread across so many resources, I thought that it would be worthwhile to create a post listing all the suggestions in a single place. When faced with a slow simulation, it’s nice to know that there are so many available speed-up options, so I hope readers will find it useful. Note that these suggestions are in the large part fully documented and supported. The ideas are listed based on semantic relationship, and not by order of importance:

Some additional ideas can be found in the blog posts and webinars mentioned in the hyperlinks at the top of this post. One of the newsletter articles concludes [2] with an example of how applying some of these techniques to a specific model resulted in reduced simulation time, from 453 down to 5 seconds.
I would like to take this opportunity to congratulate MathWorks on a job well done with Simulink’s Performance Advisor. I expect a variant of this tool to be available for regular Matlab m-code in some future Matlab release; it would blend in nicely with the existing mlint (Code Analyzer) tool.

Advanced Matlab Programming course – London 10-11 March, 2014

If this topic has piqued your interest, consider joining my Advanced Matlab Programming course [36] in London on 10-11 March, 2014. In this course/seminar I will explore numerous other ways by which we can improve Matlab’s performance and create professional code. This is a unique opportunity to take your Matlab skills to a higher level within a couple of days.

3 Comments (Open | Close)

3 Comments To "Improving Simulink performance"

#1 Comment By Etienne On February 16, 2014 @ 13:27

I would appreciate any advice on speeding up mexCallMatlab functionality. At the moment I have a fortran mex function that calls a Matlab function via mexCallMatlab, that then calls the derivative values of a Simulink model. This is painfully slow and I am trying to figure out how to write a TLC script that can generate C-code from the Simulink model in the correct format, so that I can avoid mexCallMatlab all together, but the TLC functionality is not very well documented as far as I can tell.

#2 Comment By Yair Altman On February 16, 2014 @ 16:03

@Etienne – perhaps you haven’t looked close enough? I think that TLC is actually extensively documented [43]. If this is not enough, then there is also a [44] and even a 340-page [45] (which is admittedly quite old). I can’t vouch for the quality of the documentation as I’ve never used TLC, but at least judging by the quantity, reading all of it should keep you busy for quite some time…

#3 Comment By Etienne On February 17, 2014 @ 14:17

Thanks Yair.