HELP ME PLEASE with this geometric mean
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
how can I make the geometric mean in a matrix of 20x15 with only the positive numbers?
0 comentarios
Respuestas (2)
Bruno Luong
el 31 de Oct. de 2020
Editada: Bruno Luong
el 31 de Oct. de 2020
Assuming A is the vector of your data
geomean = exp(mean(log(A)))
0 comentarios
Ameer Hamza
el 31 de Oct. de 2020
You can do it like this
x = randn(20, 15);
x_positive = x(x>0);
geo_mean = prod(x_positive)^(1/numel(x_positive))
1 comentario
Bruno Luong
el 31 de Oct. de 2020
Careful about overflow with prod
x=10*ones(1,1000)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!