Mean or average is the **average** of a sequence of numbers. In MATLAB, **mean (A)** returns the mean of the components of A along the first array dimension whose size doesn’t equal to 1. Suppose that A is a vector, then mean(A) returns the mean of the components. Now, if A is a Matrix form, then mean(A) returns a row vector containing the mean of every column.

You are watching: Average of array matlab**Mean** =**Example****:**Mean of sequence x = <1,2,3,4,5> = Sum of numbers/Count of numbers = 15/5 = 3

Different syntax of the **mean()** method is:**M = mean(A)****M = mean(A,’all’)****M = mean(A,dim)****M = mean(A,vecdim)**

**M = mean(A)**

It returns the **mean**of sequence A.If A is a

**vector**, then it returns the mean of

**all elements**in the vectorIf A is a

**matrix**, then it returns a vector where each element is the mean of

**each column**in A.

**Example:**

**Output:**

**Output :**

**M = mean(A, ‘all’)**

It returns the **mean**of

**all the elements**in A either it can be vector or matrix.

**Example:**

**M = mean(A,dim)**

It returns the **mean**of matrix A along each of the given

**dim.**If

**dim = 1**, then it returns a vector where the mean of

**each column**is included.If

**dim = 2**, then it returns a vector where the mean of

**each row**is included.

See more: Love Is Kind Of Crazy With A Spooky Little Girl Like You Lyrics

**Example:**

**Output :**

**M = mean(A,vecdim)**

It returns the **mean**of A based on the specified dimensions

**vecdim**in A.If A is a

**2-by-2-by-3**array, then

**mean(A,<1 2>)**calculates the mean of

**each page**of size

**2-by-2**as it’s considered as a single entity. So it returns the vector of size 3 as the mean of each page.

**Example:**

**Output:**

Class 12 RD Sharma Solutions - Chapter 32 Mean and Variance of a Random Variable - Exercise 32.2 | Set 1

Class 12 RD Sharma Solutions- Chapter 32 Mean and Variance of a Random Variable - Exercise 32.1 | Set 1

Types of 2-D discrete data plots in MATLAB2D Array Interpolation in MATLABHow to Use Logical Operator Within If Statements in MATLAB?How to extract numbers from cell array in MATLAB?How to remove space in a string in MATLAB?

How to find sum of elements of an array in MATLAB?MATLAB - Trapezoidal numerical integration without using trapzEstimation of gaussian noise in noisy image using MATLABInstalling MATLAB on MacOSHow to Iterate through each element in N-Dimensional matrix in MATLAB?

We use cookies to ensure you have the best browsing experience on our website. By using our site, youacknowledge that you have read and understood ourCookie Policy & Privacy PolicyGot It !