how to find index of 50% of sum of signal?

조회 수: 1 (최근 30일)
benghenia aek
benghenia aek 2021년 11월 26일
답변: Image Analyst 2021년 11월 27일
how to find index of 50% of sum of signal
a=[4 2 3 1 5 6 11];
sum(a)=32
50% of sum signal =16
indice which is approximately equal to of sum of 50% of sum signal a is 5

답변 (2개)

Walter Roberson
Walter Roberson 2021년 11월 26일
Hint:
4, 2, 3, 1, 5, 6, 11
4, 4+2, 4+2+3, 4+2+3+1, 4+2+3+1+5, 4+2+3+1+5+6, 4+2+3+1+5+6+11 -->
4, 6, 9, 10, 15, 21, 32
4<=32/2, 6<=32/2, 9<=32/2, 10<=32/2, 15<=32/2, 21<=32/2, 32<=32/2 -->
true, true, true, true, true, false, false
1 2 3 4 5

Image Analyst
Image Analyst 2021년 11월 27일
Isn't this a duplicate?
If it's not your homework, you can use my solution:
a=[4 2 3 1 5 6 11];
s = sum(a)
c = cumsum(a)
[minDiff, index] = min(abs(c - s/2))
If it is your homework, tag it as homework and find a different way.

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by