Fortune Telling Collection - Fortune-telling birth date - How to calculate the average value in matlab

How to calculate the average value in matlab

1. Step 1: Open matlab and enter a = [122435] in the command line window; 26 78 56], create a matrix with 2 rows and 3 columns, as shown in the following figure:

2. Step 2: Enter mean(a (:)) in the command line window, and find the average value of all elements of the A matrix, as shown in the following figure:

3. After pressing Enter in the third step, you can see what is the average value of all elements of the A matrix? 38.5000, as shown in the following figure:

4. Step 4 If you want to find the average value of each column of the matrix, enter mean(a, 1), as shown in the following figure:

5. Step 5 If you want to find the average value of each row of the matrix, enter mean(a, 2), as shown below: Done.