How to find the average in for loop?

2 次查看(过去 30 天)
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?

回答(1 个)

KSSV
KSSV 2021-5-20
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 ;

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by