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!