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.
Related Topics
MATLAB diagonal matrixdiag() command or function gives diagonal elements or creates a diagonal matrix, after reading this…
MATLAB matrix inverseinv( ) command or function gives the inverse of a matrix, after reading this MATLAB…
MATLAB onesThis command creates an array of all ones, after reading this MATLAB ones topic, you…
MATLAB eyeThis command creates an Identity matrix, after reading this MATLAB eye topic, you will know the…
MATLAB titletitle() command puts the title on the plot, after reading this MATLAB title topic, you will…