Thursday, September 11, 2008

My Matlab Tutorial

matrix operation:
-rand(7) = 7x7 random matrix
-rand(2,5)
-magic(5) = magic square

-eye(6) = identity matrix
-zeros(4,7) = zero matrix
-ones(1,2) = one matrix

x= [1 2 3; 4 5 6; 7 8 9]
x' => inverse matrix

Variables:
built-in: pi, eps
who -> list all envir/usr var

x = 5 => display ans
x = 5; => do NOT display ans on screen

clear x; -> delete var x

func: sin(d), exp(d),log(d),abs(d)
rounding func: round, fix, ceil, floor

No comments: