Calculating GeoMean of a double array
조회 수: 4(최근 30일)
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
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!