Matrix functions

Function

Returns

abs(m)

Absolute value of each element of m

acos(m)

Arc cosine of each element of m

asin(m)

Arc sine of each element of m

atan(v)

Arc tangent of each element in v

cos(m)

Cosine of each element of m

det(m)

Determinant of square matrix

diag(v)

Square matrix with vector v on diagonal

eq(m,n)

Determine equality of m and n

exp(m)

Matrix where each element is equal to e raised-to-the-m(i,j) power

eye(n)

Produce n x n matrix with 1s on the diagonal

inv(m)

Invert square matrix m

length(m)

Number of elements of m

log(m)

Log base e of each element

log2(m)

Log base 2 of each element

log10(m)

Log base 10 of each element

max(m)

Vector: provide maximum element in the vector; Matrix: provide a vector that contains the maximum element in each column of the matrix

min(m)

Vector: provide minimum element in the vector; Matrix: provide a vector that contains the minimum element in each column of the matrix

ne(m,n)

Determine inequality of m and n

norm(m,n)

Vector: Euclidean norm; Matrix: spectral norm

ones(n)

Produce n x n matrix of all 1s

pi

Scalar pi

prod(m)

Product of each column in the matrix

quit

Close OML window

rand(n)

Random number entries

real()

Real part of a complex number

reshape(m.r,c)

Reshape matrix m to r rows and c columns

rot90(m)

Rotate matrix 90o counter clockwise

sawtooth(t,w)

Triangular periodic waveform with amplitude between + / -1 and 2*pi wavelength

sin(m)

Sine of each element of m

single(m)

Convert to single precision

size(m,k)

Number of elements in the kth dimension

sqrt(m)

Square root of each element of m

sum(m)

Row vector each element is column sum of m

tan(m)

Tangent of each element in m

zeros(n)

Produce n x n matrix of all 0s