Cody

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

67.35% Correct | 32.65% Incorrect
Last Solution submitted on Dec 21, 2018

Problem Recent Solvers24

Suggested Problems

More from this Author2