Some Matlab Basics

With Matlab up an running, try the following commands to see what this program can do. You can type the commands into the Matlab Command window or cut and paste.

Vectors in Matlab
To create a vector:
 t = 0:0.0001:.05;
creates a vector from 0 to .05 in .0001 increments. The semicolon causes the data not to be printed to the screen (type the command without the semicolon and see!). This vector can now be used to create other vectors easily:
 y1 = sin(100.*3.14*t) ;
y1 has the length of t and consist of the sine values. You can create a vector of cosines by typing
y2 = cos(100.*3.14*t) ;
which creates a vector of values of cosine and places them in the variable y2.

Plotting and Printing

This is not very exciting; although Matlab has done all the work, you need to see the results. This is pretty easy, the following commands do the trick:

plot(t,y1)
or
plot(t,y2)
No matter what platform (PC/MAC/UNIX) you will see the plots appear. To plot on PC/MAC is easy; make the figure you want active (click in that window) and the go to the "File" and select the "Print" option. For UNIX you have to use the Matlab print command and then go into UNIX and print the document the standard way.
For more information on plotting Click here