Borrar filtros
Borrar filtros

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

3 visualizaciones (últimos 30 días)
benghenia aek
benghenia aek el 26 de Nov. de 2021
Respondida: Image Analyst el 27 de Nov. de 2021
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

Respuestas (2)

Walter Roberson
Walter Roberson el 26 de Nov. de 2021
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 el 27 de Nov. de 2021
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.

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by