Calculating GeoMean of a double array
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
iceskating911
el 1 de Jul. de 2022
Comentada: iceskating911
el 1 de Jul. de 2022
Hi! I'm still learning MATLAB and have a question about calculating the geometric mean.
Right now, I have a long forloop that is looping for 10 iterations. I have a 1x16 double array that is the result of the first part of my forloop and looks something like this:
It is a 1x16 double array with a summed value in each array spot.
Now I want to take the geometric mean of each column in the same forloop to get another 1x16 double array with one value in each column.
So far, the part for that, looks like this:
a = SimData(:,78);
b = SimData(:,80);
for ii = 1 : length(edges)-1
indexes = a > edges(ii) & a <= edges(ii+1);
binByBinSums(ii) = sum(b(indexes)); %Summed value that creates the 1x16 double
boot_mean(i)=geomean(binByBinSums); %Geometric mean for each ieration of binByBinSums
end
However currently this code gives me boot_mean as taking the geometric mean across the board, 10 times, as shown below:
How do I go about calculating the geometric mean of one column in a double? Any help is very appreciated, thank you!
0 comentarios
Respuesta aceptada
GeeTwo
el 1 de Jul. de 2022
% Here's some data for a sample
A=magic(4)
% And here we'll calculate the geometric mean of each column
vect=prod(A,1).^(1/size(A,1))
Más respuestas (0)
Ver también
Categorías
Más información sobre Scan Parameter Ranges en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!