How do I compute the geometrical mean given the data: 92.3, 93.2, 91.9, 93.5, 92.7, 93.1, 93.8, 92.4

2 views (last 30 days)
D5=[92.3 93.2 91.9 93.5 92.7 93.1 93.8 92.4];
n=length(D5);
geometric_mean=0
for q=1:n;
z=D5(q);
geometric_mean=geometric_mean*z;
end
the formula for geometric mean is Gm = n^sqrt(x1*x2*x3...xn)
In line 6, I don't know how to make the formula using matlab language

Answers (1)

Walter Roberson
Walter Roberson on 16 Jun 2016
nthroot(prod(D5), length(D5))

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!