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 Solvers6675
Suggested Problems
-
Create a square matrix of multiples
482 Solvers
-
368 Solvers
-
419 Solvers
-
Relative ratio of "1" in binary number
1454 Solvers
-
Find the sides of an isosceles triangle when given its area and height from its base to apex
1971 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!