You can calculate the arithmetic mean of various number structures as matrices, vectors, etc. in Matlab®. You do not need to write the whole mathematical equation to calculate the arithmetic mean of vectors or matrices in Matlab®. There is a special command to do it in Matlab®. In this article, we will show you how to calculate the arithmetic means of vectors, matrices in MatLab®.
How To Calculate Arithmetic Means Of Vectors And Matrices In Matlab®?
>> a = [2 6 2 64 23 45 632 45 6823]
b = [263 62 626; 65 56 562; 5412 12621 23]
mean(a)
mean(b)
a =
2 6 2 64 23 45 632 45 6823
b =
263 62 626
65 56 562
5412 12621 23
ans =
8.491111111111111e+02
ans =
1.0e+03 *
1.913333333333333 4.246333333333333 0.403666666666667
>>
We created an ‘a’ vector and ‘b’ matrix to show you the working principle of the ‘mean()’ command in Matlab®. You just type the variable inside the mean() command as shown above. Also, you can directly type the matrices or vectors inside the parentheses of the mean() command to calculate the arithmetic mean of them in Matlab®.
The arithmetic mean of ‘a’ vector is calculated as shown above. There is one value of arithmetic calculation in Matlab®.
Also, the arithmetic mean of the ‘b’ vector is calculated, and has 3 values. So each row’s arithmetic calculation is done separately with the ‘mean()’ command in Matlab®.
Conclusion
So the calculation of arithmetic mean is very basic in Matlab® as you see.
Do not forget to leave your comments and questions below about the ‘mean()’ command in Matlab® below.
If you want further coding examples about the ‘mean()’ command in Matlab®, inform us in the comments.
This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®
Your precious feedbacks are very important to us.
Leave a Reply