Summation of a series without for loop
조회 수: 3 (최근 30일)
이전 댓글 표시
I have a summation equation below, but the data subscript n and k is too big where for loop execution is too slow, how can I do without using any for loop?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1235527/image.png)
댓글 수: 1
Jan
2022년 12월 19일
Modern Matlab versions process FOR loops very efficiently. I assume, the bottleneck of your code is the very expensive exp() function. Therefore avoiding the loop will not accelerate the code. It is even possible, that the need for large temporary arrays of a vectorized version decreases the speed.
Is it possible to reduce the number of exp() calls? This would be possible if the z_n are not unique.
Please post your current code and some meaningful input data. Maybe we can see another problem.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!