=== Basic commands *Command //whos//: displays the information of all current variables *Command //clc//: clear the screen *Command //lookfor something//: search command by keyword //something// === Commands * create symbolic variables: use command //syms x// to create symbolic variable //x// * create diagonal matrix: use command //A=diag(v)//, where //v// is vector; see also the documentation [[http://www.mathworks.com/help/techdoc/ref/diag.html|diag]] === Save and load variables {{{ save myfilename load myfilename }}} use command //who// to see whether we load the variables or not === Let's show the steps of orthogonally diagnoalization of a symmetric matrix A in MATLAB lingo # Make sure A is symmetric, that is A == A' # Compute the eigenvectors of A, [V, D] = eig(A); Explanation: A*V=V*D. So if we write $V=(v_1,\cdots,v_n), D=diag(\lambda_1,\cdots,\lambda_n)$, then $Av_i = \lambda_i v_i$ for $i=1,\cdots,n$. # Turn this into an orthonormal basis, [Q, R] = qr(V) # Verify its correctness, show that inv(Q)*A*Q is a diagonal matrix. === Plot using data {{{ >>load mydata.dat }}} this command loads the data in file mydata.dat into a matrix //mydata//