Google
Showing posts with label MATLAB Commands. Show all posts
Showing posts with label MATLAB Commands. Show all posts

Sunday, August 31, 2008

Top 10 Matlab Commands for Linear Algebra Students

1. basic input: "A = [ 1 2 3; -1 2 3; 2 4 5 ]" inputs a 3x3 matrix by rows; variants
"b = [ -1 2 1]' " or "b = [ -1; 2; 1]" to input a column vector b, and
"C = [ A b ]" to produce a matrix C containing A augmented with b.
Note: "format compact" reduces output spaces; also try "format long", "format rat", "help format".
2. rref: "rref(A)" reduces A to reduced echelon form; see also "rrefmovie(A)".
3. basic arithmetic: "A*B", "A+B", "A\b" to multiply and add matrices, solve Ax = b.
4. help: "help command" gives information about "command", e.g. "help rref".
Note: "more on" gives output (e.g. from help) one screen at a time.
5. lookfor: "lookfor keyword" tries to find commands relevant to "keyword"; e.g. "lookfor null".
6. diary: "diary myfile" records subsequent output in the file "myfile" for printing later;
"diary off" stops the recording; "!mail name@email.address < myfile" emails "myfile" to "name@email.address" from a computer with a Unix OS.
7. rand: "rand(6,4)" produces a random 6x4 matrix.
8. det: "det(A)" computes the determinant of a square matrix A.
9. inv: "inv(A)" tries to compute the inverse of a square matrix A.
10. eig: "eig(A)" computes eigenvalues(vectors) for square A; try "help eig" for more info.

Note: the uparrow key gives previous commands that may be edited to save typing; this only works if your keyboard characterstics are properly recognized.

Website Value