Wednesday, 9 August 2017

octave learning note -compute



matrix multiply another matrix by *



in .*  and .^, "." -- dot means compute elements, one by one.   "^2" means squaring




get 绝对值



plus one for all elements in a vector


another way to do this

trans the matrix by '
find max of a matrix



the 3rd param is which dimension you want to find the max.  1 means max of each column.   2 means max of each row.



max(A) is same as max(A,[],1]
if you want to find max elements in this matrix then you need to call max 2 times:
max(max(A))

or max(A(:))       A(:) will make all of them into a vector







same as other functions like size and max, sum will sum each columns,   same as sum(A,1).

sum(A,2) will sum each row.




























No comments:

Post a comment