Other useful MATLAB functions

For vectors, to find the maximum and minimum values of the vector x, we use the command/function max(.) and min(.)

Example

Fig 1.12. The minimum and maximum values from a vector x

To find the summation and the production values of the vector x, we use the command/function sum(.) and prod(.)

Example

Fig 1.13. The sum and the product of the element in a vector x

For vectors, to sorts the elements of a given vector x in ascending order arrange without or with reputation, we use the command/function unique(.) and sort(.)

Example

Fig 1.14. Arranging the vector's value from smallest to largest with or without reputation

Again, to sorts the elements of a given vector x in descending order, we use the command/function sort(.,'descend')

Example

Fig 1.15. Arranging the vector's value from largest to smallest

The mean of a vector, also known as the average equals the sum of the vector elements divided by the number of elements in the vector, we use the command/function mean(.)

Example

Fig 1.16. The mean of the vector x

Note

You can get information about the dimension of a vector using command/function length(.)

Example

Fig 1.17. The dimension of the vector x