作业帮 > 综合 > 作业

matlab问题:tic,toc是什么东西,怎么用的

来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/09/21 19:54:34
matlab问题:tic,toc是什么东西,怎么用的
tic, s=0; for i=1:100000, s=s+1/2^i+1/3^i; end; toc
这样的一个语句,为什么每次的到的结果不同
Elapsed time is 0.189000 seconds.
Elapsed time is 0.210000 seconds.
Elapsed time is 0.196000 seconds.
Elapsed time is 0.203000 seconds.
Elapsed time is 0.197000 seconds.
Elapsed time is 0.205000 seconds.
Elapsed time is 0.199000 seconds.
Elapsed time is 0.199000 seconds.
Elapsed time is 0.189000 seconds.
matlab问题:tic,toc是什么东西,怎么用的
tic表示开始计时
toc表示计时结束
这两个语句是计算仿真消耗的时间