Speed up simulation

2 views (last 30 days)
Alexandru
Alexandru on 26 Jun 2012
Hello,
I've read some of the questions posted on mathworks regarding this subject, but still I want to speed up the simulation for example by 10 times or 100 times.
The reason to do this is because I'm using a signal builder with lots of values used for testing a model and writing the outputs in an excel and to do this for all the values would take about 7h...
Thanks in advance, Alex

Accepted Answer

Kaustubha Govind
Kaustubha Govind on 26 Jun 2012
There are several techniques for improving your Simulink model's performance. Please see these articles:
Also, you mentioned writing outputs to an Excel file - do you do this at the end of simulation or at each time step? I'm assuming you use the XLSWRITE command?
  3 Comments
K E
K E on 26 Jun 2012
You may also find this blog entry helpful for making sure you are not wasting time with the wrong step size, http://blogs.mathworks.com/seth/2012/06/04/the-most-useful-command-for-debugging-variable-step-solver-performance/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+SethOnSimulink+%28Seth+on+Simulink%29
Kaustubha Govind
Kaustubha Govind on 27 Jun 2012
Nice tip KE!
@Alexandru: XLSWRITE opens and closes the Excel file at each time step, which I suspect may be slowing down your simulation. You could try using the Simulink Profiler to see where the slowdown is coming from before investing in improving the Excel writing part. If that S-function turns out to be the culprit, what you need is to only open once, write all your data and close it. You can either do this in your S-function by controlling the Excel COM connection (relevant function is: http://www.mathworks.com/help/techdoc/ref/actxserver.html) so that you open the file in setup() and close in terminate(). Or if you prefer to stick with XLSWRITE, just do it at the end of simulation.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!