How to calculate execution time in Matlab?

2 次查看(过去 30 天)
#Help_Please
Hello, hope that you're in a good health
I have 2 heuristics and i want to calculate the execution time for each instance, what's the right instruction to do it?

采纳的回答

Jan
Jan 2022-7-30
The direct method:
tic
x = sin(rand(1e4, 1e4));
toc
Elapsed time is 1.294872 seconds.
The smart method:
timeit(@() sin(rand(1e4, 1e4)))
ans = 1.2593

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by