MATLAB mean

mean( ) command or function gives the mean or average value of vector or matrix or array elements, after reading this MATLAB mean topic, you will know the theory and examples.


Syntax:

mean(n)

  • n can be a vector or matrix.

Example: To calculate the mean of vector elements.

Output:

ans =

1.5000

Example: To create a matrix and calculates the mean of each column.

Output:

n =

     1     2     3
     3     2     1
     4     5     1


v =

    2.6667    3.0000    1.6667

Explanation:

  • 2.6667, 3.0000 and 1.6667 is the mean value of the first, second and third column elements respectively.

Leave a Comment

Your email address will not be published. Required fields are marked *

error: Content is protected !!
Scroll to Top