Geometric mean is a very important tool in such disciplines like Calculus, Data Analysis and others. It has the formula;
Calculation of geometric mean by hand can be troublesome. But calculation of geometric mean of set of data in Matlab is very easy with ‘geomean()’ command. Do not mix the geometric mean with arithmetic mean, they are different.
YOU CAN LEARN MatLab IN MECHANICAL BASE; Click And Start To Learn MatLab!
In here, we explain how to calculate geometric mean of datas in Matlab with ‘geomean()’ command, with a very basic example below.
How To Use ‘geomean()’ Command In MatLab?
>> a = [2 6 3 4 64 64 3 43 6 14 6 163 6 3 61 6164]; x = geomean(a) x = 16.8519
As you see above, we created a vector that includes lots of numeric data inside it. Calculation of geometric mean of these lots of data can be troublesome compared with calculation in MatLab.
What you need to do is, just write the vector variable ‘a’ inside the parantheses of ‘geomean()’ command.
The result is given in Command Window like above.
>> a = [2 6 3 4; 64 64 3 4; 6 14 6 163; 6 3 61 6164]; x = geomean(a) x = 8.2391 11.2693 7.5758 63.3202
If you calculate the geometric mean of a matrix like above in Matlab, calculation will done for each columns elements. So the result will have vector like above that has number of columns of the matrix.
Do not forget to leave your comments and questions about calculation of geometric mean in MatLab with ‘geomean()’ command below. Your precious feedbacks are very important for us.
Leave a Reply