Speed up simulation

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

 采纳的回答

Kaustubha Govind
Kaustubha Govind 2012-6-26

1 个投票

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 个评论

The inputs are always changing so yes I'm using a Level 2 S-Function to write the results with the XLSWRITE. But I could try to write the outputs in a cell array and write them at the end in the excel...
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
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.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Simulink 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by