Optimizing MATLAB code

前端 未结 3 1303
慢半拍i
慢半拍i 2021-01-06 04:44

This code takes an extremely long time to run (more than 10 minutes). Is there any way in which I can optimize it so that it finishes in less than one minute?



        
3条回答
  •  佛祖请我去吃肉
    2021-01-06 05:04

    The inner loop is executing around 1000000*(1000000+1)/2 = 500000500000 times! No wonder it is slow. Maybe you should try a different approximation approach.

提交回复
热议问题