MATLAB tutorial exploring the basics of using MATLAB. See how to enter commands, create plots, perform matrix operations and get help. Check out and learn the basics of matlab from the following video.

(3) The top menu bar can be used to open or write a M-file, which will be addressed later. Once started, MATLAB will provide some introductory remarks and pop up the MATLAB prompt >>.

(4) Help Facility. By typing "help", "help <topics>", you can get on-line help.

» help
(5) The following result will appear and you can choose any topics that you need some help with.

(6) If you need help for ODE (ordinary differential equation), you can type in:

and the following help topics related to ODE will appear.

(7) Performing very simple function

Let's try an example. At the command prompt, type in x = 2.

After that click "enter" and the following will appear.

Repeat the entire process by defining y = 3 at the command prompt. The overall process is shown below:

Now, at the command prompt, type in x + y and press "ENTER". The following will appear where 2 + 3 = 5 will be shown.

(8) Saving working space

After performing a process or calculation, you might perhaps want to save the file. Terminating a MATLAB session deletes the variables in the workspace. Hence, before quitting, you can save the workspace for later use by typing "save", which saves the workspace automatically as "matlab.mat". Or, you can also choose "save workspace as" with other "filenames". For this example, I'll save it as "example1.mat".

lternatively, you can save using other methods. In this case, we save it using the selected variables. To illustrate this, at the command prompt, type

>> save temp x y

which saves the current variable "x, y" into "temp.mat" as shown in the figure below.

(9) To retrieve all the variables from the file named "temp.mat", type
» load temp

MATLAB uses conventional decimal notion, builds expressions with the usual arithmetic operators and precedence rules. Please try out hands on the exercises below. Define "x" and "y". Try it out and get the feel.

Now try defining "z" and combine it with the above in the same command window.

Now try the following function.

B. Matrix Operations

Matrix operations are fundamental to MATLAB. Within a matrix, columns are separated by space, and the rows are separated by semicolon";". For a start, type in the following after the common prompt:

>> A = [1 2 3; 4 5 6; 7 8 9]

Try it out and you will see the following result.

Now, try this new exercise using "ones" in the matrix as shown in the figure below:

Be careful of the sign "[ ]" and "( )". It you type in wrongly, the result will be an error. Try using the a "[ ]" for the previous example.

Now, try summing up "A" and "B" and the following will be produced in the matlab command window:

Did you get it? It's simple right!

Now let's try to make the inverse of the matrix A. This can be done by following the example below:

You can try to add, subtract and others using other matrix operations available in MATLAB as shown below: