Borrar filtros
Borrar filtros

How to find the average in for loop?

2 visualizaciones (últimos 30 días)
Jiyeon Jang
Jiyeon Jang el 20 de Mayo de 2021
Comentada: Jiyeon Jang el 20 de Mayo de 2021
for j = 1 : 1 : 10
Ry = max(Y(160 * (j-1) + 1:160*j)) + abs(min(Y(160 * (j-1) + 1:160*j)));
end
In this code, How to find the average of Ry in for loop?

Respuestas (1)

KSSV
KSSV el 20 de Mayo de 2021
avg = 0 ;
for j = 1 : 1 : 10
Ry = max(Y(160 * (j-1) + 1:160*j)) + abs(min(Y(160 * (j-1) + 1:160*j)));
avg = avg + Ry ;
end
avg = avg/j ;

Categorías

Más información sobre Loops and Conditional Statements 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