User:Eml4500.f08.jamama.justin/Mat

Accessing Matlab
 * On most systems one can enter Matlab with the command matlab, although on other systems you can access it through a menu or just by clicking an icon.

Entering Matricies
 * Matlab mainly works with a rectangular numerical matrix. All variables represent matrices.

Imaginary numbers can also be entered, using the units i or j.


 * Large amounts of data can easily be loaded using the command load data.ext, where .ext could be any extension. The best files to use are ASCII files.
 * To just create matrices one can just use some of the built in functions.

Individual parts of matrices can be referenced simply by their address. so A(2,3) will select the entry in matrix A, row 2, column 3.

TRY IT!

Matrix operations, array operations


 * If the sizes of the matrices your trying to operations on do not coincide with one another an error message will appear, that is unless one of the matrices is a scalar (a 1X1 matrix). A scalar can be used on any size matrix.
 * Also, the division operators are related to one another. Right division is defined in terms of left division by b/A = (A'\b')'.

Matrix operations, array operations

 Array Operations Although addition and subtraction only operate entry-wise, the other operations are matrix operations. Entry-wise will operate on each of the individual elements, while matrix operations operate on the matrices as a whole.

Matrix operations, array operations

TRY IT

Statements, expressions, and variables; saving a session
 * Matlab statements are usually in the simple form of expressions, which are typically composed of operators functions and variable names. When an expression is evaluated it is turned into a matrix with a variable as its name.  If no variable is assigned, a variable ans is created to store that particular matrix.
 * Statements end by pressing enter. They can be continued by putting three or more periods then pressing enter, or can simply be put on one line (but they must be separated by comas or semi-colons).
 * Putting a semicolon at the end of a line makes it so the operation is still done, yet it is not immediately printed.
 * Matlab is case sensitive; A is different than a.
 * The command Who will list all current variables.
 * The command clear can be used before a variable to just delete that one, or used on its own to delete all variables.
 * The permanent variable epsilon (eps) rounds to about 10^-16 on most machines which can be used for converging iterative processes.
 * To stop an unwanted computation without leaving matlab press CTRL-C.

Saving a Session One can hit the save button to store a session as a diskfile with the extension .mat. You can then re-enter Matlab later and use the load function to restore the former workspace.

Matlab Homework Assignment Code