Problem 42351. Average valid values of arrays
Given a 1D array (column or row vector), compute the average of valid values. Valid values are defined via two thresholds: minValue and maxValue. Example:
x = [-1 -5.4 14.6 20.9 25.5 -22.4 18 15.5 -33.7 -38.1]; minValue = -10; maxValue = 10; y = validAverage(x, minValue, maxValue) = -3.2
To keep it simple, let's assume minValue and maxValue are within the array range.
Solution Stats
Problem Comments
-
1 Comment
Ben Gribov
on 13 Dec 2021
Really interesting problem, I enjoyed solving it!
Solution Comments
Show commentsProblem Recent Solvers58
Suggested Problems
-
Find the longest sequence of 1's in a binary sequence.
6231 Solvers
-
8987 Solvers
-
ベクトル [1 2 3 4 5 6 7 8 9 10] の作成
549 Solvers
-
Find out total non zero element of matrix
267 Solvers
-
Matlab Basics - y as a function of x
492 Solvers
More from this Author2
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!