Matlab is a software package that allows number, vector, and matrix manipulation and visualization. To start working with Matlab, double click on the Matlab icon on your desktop. This will open the Matlab screen.

Matlab works mainly with vectors, collections of numbers arranged in a sequence.

Let us create vector x . Type at the Matlab prompt:

x=[1:1:10];

(Note: Experiment by omitting the ";" at the end of the command.)

Then type x. You will see on the screen:

x =
1 2 3 4 5 6 7 8 9 10

Now, let us compute function y = 2 x. Type at the Matlab prompt:

y= 2 * x;

To plot y vs. x, we type:

plot(x,y);

xlabel(‘x’)

ylabel(‘y’)

title(‘y = f(x)’)

Command "plot(x,y)" sets x as the horizontal axis and y as the vertical axis. Commands "xlabel" and "ylabel" produce labels for the two axes. Command "title" produces a title at the top of the plot.

After you type the plot command, a graphics window will open on your screen showing the desired plot. On the top of your graphics window there is a tool bar. With your mouse go to File on the toolbar and select Print. This action prints the plot shown on your window to the default printer connected to the computer you are using. To see more details on printing, type at the Matlab prompt.

help print

Command "help" is a command you should familiarize yourself. It shows you how Matlab commands should be used. For example, type:

help plot

and you will get information on the usage of "plot". To find out more about command "help", type

help help

Command "help" is useful when you know the exact command you want to use and you want to find out details on its usage. Sometimes we do not know the exact command we should use for the problem we need to solve. Then we can use command "lookfor". Type

lookfor label

and you will get as a result a number of Matlab commands that have to do with labels. Among these commands you will see commands "xlabel" and "ylabel" that we discussed earlier.