Array Functions in MATLAB

Array Functions in MATLAB

MATLAB provides some build-in function for Array handling.

Function Description
length(A) Returns the number of elements in Array A
size(A) Returns a row  vector [m,n]
where m and n are the size m*n of the Array A
reshape(A,m,n) Creates a m by n matrix from the elements of the matrix A
Where matrix A must have m*n elements
diag(V) Creates a square matrix with the elements of v in the diagonal, when V is vector
diag(A) Creates a vector from diagonal elements of A, where A is a matrix
mean(A) Returns the mean value of the elements of the vector A
max(A) Returns largest element in the vector A
[l,n] = max(A) l is largest element in the vector A and n is the position of largest element in vector A
min(A) Returns minimum element in the vector A
[s,n] = min(A) s is smallest element in the vector A and n is the position of smallest element in vector A
sum(A) Returns the sum of all element of the vector A
sort(A) Arranges the elements of the vector in ascending order
median(A) Returns the median value of the elements of the vector A
std(A) Returns the standard deviation of the elements of the vector A
det(A) Returns the determinant of the square matrix A
dot(a,b) Calculates scalar product of two vectors
cross(a,b) Calculates cross product of two vectors
inv(A) Returns inverse of a square martix A
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s