The Basics

Calculator functions work as you'd expect:

>>(1+4)*3

ans =

	15
+ and - are addition, / is division, * is multiplication, ^ is an exponent.

You can assign variables from the matlab workspace. Everything in matlab is a matrix. (If it's a scalar, it's actually a 1x1 matrix, and if it's a vector, it's an Nx1 or 1xN matrix.)

>>a = 3
a =

     3

To create a vector is pretty similar. Each element is separated by spaces, the whole vectore is in square brackets:

>>v = [1 3 6 8 9]

To create a vector of values going in even steps from one value to another value, you would use

>>b = 1:.5:10

This goes from 1 to 10 in increments of .5. You can use any increment, positive or negative, you just have to be able to get to the last thing from the first thing, using those increments. If you don't put in an increment, it assumes it's 1, so 1:5 gives you the vector [1 2 3 4 5].

To turn a row vector into a column vector, just put a ' at the end of it. (This is also how to get the transpose of a matrix.) To create a matrix, you could do something like:

c = [1 3 6; 2 7 9; 4 3 1]

The semicolons indicate the end of a row. All rows have to be the same length.

Whenever you assign a value in matlab, it will print out the entire value you have just assigned. If you put a semicolon at the end, it will not print it out, which is much faster.