weighted mean should really be sum(x.*w)/sum(w), and not as defined in the problem.
I agree with the definition above. You need to define the sum of all the weights and not the number of weights.
As the others have said, the problem title is flat out wrong. What is required is simply not a weighted average in any standard form.
Come on Mathworks, delete this problem!
The test suits for this problem should have tests with different vector length.
There are "solutions" that just divide by 3.
I think the program title is wrong as in weighted average the denominator should contain sum of all weights
Hahaha, who wrote this problem? This is not a weighted average! Just look at the example provided: the weighted average of 1, 2 and 3 is 33.3333, hahahahaha!
this is not really the weighted average, because of 10 15 and 20 the average can't never be 33.333 here is a bug
Yes. The description is completely wrong. To start with, a weighted average should have the property that
weighted_average(x,w) == weighted_average(x,k*w)
So a simple re-scaling of the weights should not impact the result.
kinda misleading, but i get the gist of it
Is it possible to remove this problem or at least change the problem name so it does not say "weighted average". As others have pointed out, the definition, via example, is inaccurate.
An average, weighted or otherwise, will not be greater than the largest number in the set (which is the case here).
In case you actually want to try a weighted average problem, you can check out the one here
why leading size is always 7? and how :(
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
@Mehmed Saad: some of the many cheating solutions have been deleted.
This problem definitely needs to be fixed to use the correct weighted average formula.
Maximum running product for a string of numbers
Renaming a field in a structure array
Back to basics 17 - white space
04 - Scalar Equations 3
Matlab Basics - y as a function of x
Find the treasures in MATLAB Central and discover how the community can help you!
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
Comuníquese con su oficina local