Matlab Tutorial Session 3
This tutorial session covers the following topics
Functions in Matlab.
Specific input and output commands to interact with the user.
Some useful commands not covered previously:
Example programs – Newton Raphson, Bairstow’s method.
Next tutorial will introduce how to create a datafile can be directly loaded in Tecplot.
Review of session 2
One point was missed in both previous sessions – matlab distinguishes between
uppercase and lowercase characters in variable names.
different variable names.
Variable names can be very long also (about 30
characters long) and can include alphabets, digits and underscore (
In matlab, either one may work at the command prompt directly, or write
in the editor (
command), save them with some suitable name (with extension
), and run them by typing the filename (excluding
) at command prompt.
Matlab can only execute an M-file when it can find them in the current directory
There are two types of M-files –
Script files are meant
to execute a program (i.e., a set or sequence of matlab statements), and these are
what were covered in session 2. This session covers functions.
loop is just like the DO loop of Fortran.
It is based upon the colon
) and can handle real numbers also, e.g.
j = 0.8 : 0.02 : 1.2
It is ended with an
Boolean conditions are evaluated as integers:
0 for false and non-zero for true.
Logical operators such as
– this is the general syntax of decision making.