Analze running time of simulation

3 ビュー (過去 30 日間)
Max
Max 2017 年 8 月 23 日
回答済み: Eeshan Mitra 2017 年 8 月 25 日
Hi,
I'd like to analyze the running time of my simulink model without time for compiling.
My understanding is, if I use
tic
sim(modelName)
toc
the compiling time is measured as well.
Another idea could be the profiler? But then my Simulation gets very slow, so I'm not sure, whether this result is correct.
Has anybody a idea?
Thanks in advance.

回答 (1 件)

Eeshan Mitra
Eeshan Mitra 2017 年 8 月 25 日
Simulink Profiler adds some overheads in the background to the functions or models being profiled. Since it gives the detailed execution time for each function during simulation, it is the best way to judge the performance of just the "simulation phase".
However, if you do not want to recompile your Simulink model, say for different iterations, consider using the "Fast Restart" option with "tic-toc". Find more information about the "Fast Restart" option in the following link:
Consider the simulation of the model "vdp" with a MATLAB script:
for i=1:4
tic
sim('vdp','FastRestart','on');
toc
end
The first run of the model involves compilation, but not the three subsequent ones. The timing adheres more to the "simulation phase" in the last three simulations.

カテゴリ

Help Center および File ExchangeScopes and Data Logging についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by