Borrar filtros
Borrar filtros

HELP ME PLEASE with this geometric mean

2 visualizaciones (últimos 30 días)
IANC Cristian Gabriel
IANC Cristian Gabriel el 31 de Oct. de 2020
Comentada: Bruno Luong el 31 de Oct. de 2020
how can I make the geometric mean in a matrix of 20x15 with only the positive numbers?

Respuestas (2)

Bruno Luong
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)))

Ameer Hamza
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))

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by