HELP ME PLEASE with this geometric mean
2 次查看(过去 30 天)
显示 更早的评论
how can I make the geometric mean in a matrix of 20x15 with only the positive numbers?
0 个评论
回答(2 个)
Bruno Luong
2020-10-31
编辑:Bruno Luong
2020-10-31
Assuming A is the vector of your data
geomean = exp(mean(log(A)))
0 个评论
Ameer Hamza
2020-10-31
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!