Effacer les filtres
Effacer les filtres

HELP ME PLEASE with this geometric mean

2 vues (au cours des 30 derniers jours)
IANC Cristian Gabriel
IANC Cristian Gabriel le 31 Oct 2020
Commenté : Bruno Luong le 31 Oct 2020
how can I make the geometric mean in a matrix of 20x15 with only the positive numbers?

Réponses (2)

Bruno Luong
Bruno Luong le 31 Oct 2020
Modifié(e) : Bruno Luong le 31 Oct 2020
Assuming A is the vector of your data
geomean = exp(mean(log(A)))

Ameer Hamza
Ameer Hamza le 31 Oct 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 commentaire
Bruno Luong
Bruno Luong le 31 Oct 2020
Careful about overflow with prod
x=10*ones(1,1000)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by