Problem 106. Weighted average
Given two lists of numbers, determine the weighted average as follows
Example
[1 2 3] and [10 15 20]
should result in
33.3333 (1*10 + 2*15 + 3*20)/3
Solution Stats
Problem Comments
-
23 Comments
Show
20 older comments
Rafael S.T. Vieira
on 19 Jul 2020
On a weighted average we should divide the weighted values by the sum of the weights and not by the number of terms. https://en.wikipedia.org/wiki/Weighted_arithmetic_mean
goc3
on 28 Sep 2020
@Mehmed Saad: some of the many cheating solutions have been deleted.
Benjamin Farris
on 2 Nov 2020
This problem definitely needs to be fixed to use the correct weighted average formula.
Solution Comments
Show commentsProblem Recent Solvers6677
Suggested Problems
-
2498 Solvers
-
Celsius to Fahrenheit converter
631 Solvers
-
400 Solvers
-
467 Solvers
-
Given a square and a circle, please decide whether the square covers more area.
1236 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!