Problem 44455. Find the average of a random sequance
Solution Stats
Problem Comments
-
2 Comments
Hello, Shaul Salomon.
. . .
Could you please double-check the consistency of your test 7 with the problem statement? The problem statement specifies that "[...] when the number 0 is generated. This number is not considered for the mean." . . .
In test 7, I get only one random number value, which is zero, and this should be discarded. Therefore the set of numbers to average is an empty set: this empty set has a sum of zero (or undefined?) and — most importantly — a count of zero. So therefore the mean there should be undefined, or NaN, as far as I can understand. This is how I implemented Solution 1391527. Please let me know if I am overlooking some important point. . . . —Thanks, David.
Interesting problem.
Solution Comments
Show commentsProblem Recent Solvers411
Suggested Problems
-
Select every other element of a vector
29574 Solvers
-
22900 Solvers
-
Back to basics 8 - Matrix Diagonals
899 Solvers
-
Add a row of zeros on top of a matrix
241 Solvers
-
Test Problem; Create a 5x5 array containing all ones
369 Solvers
More from this Author25
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!