=============== MATLAB OVERVIEW =============== ------------ About MATLAB ------------ MATLAB is an interactive computing environment and a programming language. Some fundamental functions are built-in, but most are actually implemented in MATLAB (which makes them very easy to modify/extend). MATLAB is very widely used by scientists/engineers, numerical analysists, machine learning people, etc. Although and IDE is provided, it is rather cumbersome so you may prefer the text-based command line interface (matlab -nodesktop). ----------- Online help ----------- Works a lot like man. Type 'help help' for more info. Type help to learn about a particular command/function. --------------- The environment --------------- ... - for multiline commands in interactive mode clc - clear screen clear - clear variables and functions from memory path - display MATLAB path plot - plot a graph hold - hold plot (useful for plot overlaying) ! - execute external command from within MATLAB . - perform vector operation op componentwise (e.g. .*) ; - do not display result type - display source for a library function (doesn't work for built-in) format - display format for numbers disp - display a message num2str - turn a number into a 'string' error - useful for unrecoverable errors who - display information about workspace variables whos - similar but more detailed exist - check whether a variable/function is defined which - path to function (if defined) quit/exit - exit MATLAB --------------------- Some useful functions --------------------- zeros - a zero vector/matrix of specified size ones - a matrix of all ones of the specified size eye - identity matrix diag - a diagonal matrix (in fact more general) length - the dimension of a row/column vector size - the dimensions of a matrix/vector abs - the absolute value/modulus max - the value (and possibly index) of maximal element min - same for minimal element linspace - equally spaced points in a given interval (useful for plot) inv - matrix inverse ' - matrix/vector transpose \ - solve linear system lu - LU decomposition chol - Cholesky decomposition eig - eigenvalues/eigenvectors cond - matrix cond norm - various vector/matrix norms rank - matrix rank (dimension of row/column space) trace - matrix trace (sum of diagonal entries) rand - randomly sample from a uniform distribution random - randomly sample from various distributions roots - approximate roots of polynomial poly - construct polynomial (coefficient vector) from roots polyval - evaluate polynomial