Azzera filtri
Azzera filtri

HELP ME PLEASE with this geometric mean

2 visualizzazioni (ultimi 30 giorni)
IANC Cristian Gabriel
IANC Cristian Gabriel il 31 Ott 2020
Commentato: Bruno Luong il 31 Ott 2020
how can I make the geometric mean in a matrix of 20x15 with only the positive numbers?

Risposte (2)

Bruno Luong
Bruno Luong il 31 Ott 2020
Modificato: Bruno Luong il 31 Ott 2020
Assuming A is the vector of your data
geomean = exp(mean(log(A)))

Ameer Hamza
Ameer Hamza il 31 Ott 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))

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by