필터 지우기
필터 지우기

HELP ME PLEASE with this geometric mean

조회 수: 2 (최근 30일)
IANC Cristian Gabriel
IANC Cristian Gabriel 2020년 10월 31일
댓글: Bruno Luong 2020년 10월 31일
how can I make the geometric mean in a matrix of 20x15 with only the positive numbers?

답변 (2개)

Bruno Luong
Bruno Luong 2020년 10월 31일
편집: Bruno Luong 2020년 10월 31일
Assuming A is the vector of your data
geomean = exp(mean(log(A)))

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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by