Function:exp(x):e^x
Commands:
who: show all variableswhos: who + types +valuesclc: clear command windowclear: clear parameter tableformat [parameter]
(parameter = short, long, shortE, longE, rational(rat))
Row vector>> a = [1 2 3 4]Column vector>> b = [1; 2; 3; 4]Matrix:>> c = [1 2 3; 4 5 6; 7 8 9]
Colon Operator
A = [1 2 3 ... 100]
j:k => [j, j+1, j+2, ..., j+m], j+m<=kj:i:k => [j, j+i, j+2i, ..., j+m*i], j+m*i<=k
A(i,:) = [] clear the i-th row of A
arithmetic
point multiplication:.*
A = [a b; c d] B = [h i; j k]A .* B = [a*h b*i; c*j d*k]
a an integer, a + A refers to the arithmetic that
each element of A plus a.
The ^ .^ / -follow the similar rule.
build some special matrixes
linspace(begin, end(, step(default value 1)))eye(n):yields an n*n identity matrix.zeros(n1,n2):yields a n1*n2 zero matrix.ones(n1,n2):resembles zeros(). uses 1 instead.diag([row_vector]):yields a diagnol matrix.rand():uniformly distributed random numbers.
Matrix functions
max(A):yields an row vector including the
maximum num of each column ofA.max(max(A)):yields the maximum num ofA.min()sum()mean()resemblesmax()in terms of rules.sort():sort elements of each columns by ascending order.sortrows():sort rows with their first element by ascending order.size():yields two numbers representing the dimensional parameter.length():yields the multiplication of the two return value of size().find():e.g.A = [1 2 3; 4 5 6; 7 8 9], thenfind(4) = 2,find(8) = 6.