Effacer les filtres
Effacer les filtres

How to find the average in for loop?

2 vues (au cours des 30 derniers jours)
Jiyeon Jang
Jiyeon Jang le 20 Mai 2021
Commenté : Jiyeon Jang le 20 Mai 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?

Réponses (1)

KSSV
KSSV le 20 Mai 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 ;
  1 commentaire
Jiyeon Jang
Jiyeon Jang le 20 Mai 2021
Thank you very much!! :)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by