Arrays
Array Functions
| Function | Description |
| sum(Z) | adds all elements of array Z |
| prod(Z) | multiplies all elements of array Z |
| length(Z) | returns the length of array Z |
| [Zmax, i] = max(Z) | returns largest element Zmax of Z and its position, i |
| [Zmin, i] = min(Z) | returns smallest element Zmin of Z and its position, i |
| sort(Z) | sorts elements of array Z in ascending order |
| find(Z>3) | finds the indices of elements of array Z larger than 3 |
Exercise
|
> Create a script M-file called arrayFunctions.m to run the following code, starting by entering comment headers with your name, the date and the purpose of the M-file.
|