Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to Collect The Time Calculated By (Tic& Toc) at each instant to Solve an Optimisation Problem in a Simulink model ?

2 ビュー (過去 30 日間)
Mohamed Abdullah
Mohamed Abdullah 2020 年 3 月 20 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I am solving an optimisation problem in a simulink model using a mtlab function block and I am using 'Tic & Toc" to calculate the time taken to solve the problem .the issue is that the resulted time is per each instant of solving the optimisation problem and my aim is to store each instant in an array so that I can calculate the average time taken by the whole process.
.How can I solve this issue?
Note:I have tried using a for loop but I was not sure about its limit ( for n=1:?)

回答 (2 件)

Dinesh Yadav
Dinesh Yadav 2020 年 3 月 24 日
I think inside the matlab function block you should run the loop for at least 1000 times to get a better estimate of avg time per computation cycle. By whole process if you mean running time of entire model follow the link below
Hope it helps.

Ameer Hamza
Ameer Hamza 2020 年 3 月 24 日
You can use the profiling tools officially provided by Mathworks to measure the execution time of each block inside the Simulink model. See the detail of how to use the profiler: https://www.mathworks.com/help/simulink/ug/how-profiler-captures-performance-data.html

この質問は閉じられています。

製品


リリース

R2013b

Community Treasure Hunt

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

Start Hunting!

Translated by