Just like arithmetic mean and geometric mean, harmonic mean is also an important aspect of calculus, data analysis and other different disciplines. Harmonic mean has a formulation like this;

As you see, calculation of harmonic means of lots of datas can be torublesome by hand. You can do this kind of thing in MatLab with ‘harmmean()’ command easily.

In here, we will show you how to calculate harmonic means of datas in Matlab with ‘harmmean()’ command, with a very basic example below.

## How To Use ‘harmmean()’ Command In MatLab?

```
>> a = [4 5 6 46 46 2 67 126 2612 94 61 943 623];
x = harmmean(a)
x =
10.7165
```

As you see, there is a very simple example of harmonic mean calculation is done in Matlab Command View. We created a vector** **that includes all the numeric data that harmonic mean must be calculated.

Calculation of harmonic mean of all these data by hand would be very troublesome.

What we did is just writing the created vector inside the parantheses of ‘harmmean()’ command. You can see that the result is given as result vector ‘x’. above in Command Window.

```
>> a = [4 5 6 46; 46 2 67 126; 2612 94 61 943];
x = harmmean(a)
x =
11.0245 4.2216 15.1526 97.6051
```

If you calculate the harmonic mean of a vector as matrix, as above, harmonic means of all columns will be calculated separately. And all the harmonic mean results will be given as vector as you see above in Command Window.

YOU CAN LEARN MatLab IN MECHANICAL BASE; Click And Start To Learn MatLab!

The use of ‘harmmean()’ command in Matlab is very simple as you see above.

Do not forget to leave your comments and questions about calculation of harmonic means of ‘harmmean()’ command in Matlab below. Your precious feedbacks about this topic are very important for us.

## Leave a Reply