필터 지우기
필터 지우기

which one is the correct procedure for summation

조회 수: 1 (최근 30일)
Renjith V Ravi
Renjith V Ravi 2017년 2월 13일
답변: Walter Roberson 2017년 2월 13일
I want to implement the following equation
Kindly tell me,which method is correct
ID =0;
for i=1:256
ID = ID+HD(i);
end
or otherwise
ID = sum(HD(1:256))
Please help me

채택된 답변

Walter Roberson
Walter Roberson 2017년 2월 13일
ID = sum(HD(1:256)) is faster.
If you were summing large enough arrays then there could be difference in the output due to round off differences when the large summation was handed over to fast routines that use multiple threads to create partial sums that are then added together.

추가 답변 (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