Introduction to matlab
MATLAB is a multifunctional computer program that allows its users to calculate a variety of different math equations,
compute algorithms, and graph/ plot functions and various sets of data. This program is extremely useful in many
professional fields as well as for students in majors including engineering and economics. One of its most important
functions is its ability to help its users produce graphs of complex functions. In this set of instructions you will learn the
basics of calculating on MATLAB and how to graph/ plot on the MATLAB program. After reading these instructions you
will be able to compute basic calculations and create graphs of data or functions that can be used for anything from
analyzing data in engineering to studying supply and demand curves in economics. These instructions are geared to give a
user new to MATLAB skills that can be used throughout their college courses and professional careers.
Workspace
Command
Window
Command
History
There are three main features to the main screen as shown in figure 1.
Command Window: Where the user enters the operation commands and data for graphing/ plotting.
All operation commands are typed in next to the double right arrows (>>) and are completed upon
hitting the enter/ return key.
Command History: A list of previously entered commands.
Workspace: In the workspace the data sets will be listed.
Throughout this set of instructions the most important window will be the command window as it will be where
you are entering the calculation and graphing operation commands.
Visual Instructions:
Figure 2:
Figure 3:
Input: a+1
Input: 5-a
3. Now try multiplication and
division with there relative
commands. (Figure 3)
Input: a*5
Input: a/4
4. Exponents can also be used in
MATLAB using exponential
commands. (Figure 4)
Input: a.^2
Note: A period must be entered
before the carrot symbol when
entering an exponent.
5. Try creating a polynomial
with various scalar commands.
(Figure 4)
Input: a.^2+2*a+5
Figure 4:
Figure 5:
Input: b*d
Figure 6:
Figure 7:
Figure 8:
Figure 9:
Input: e*3
16. In order to do calculations
with two matrices we first have
to create another. (Figure 9)
Input: f=[2 4 6
8 10 12
14 16 18]
17. To add or subtract these
matrices simply input f+e or f-e.
(Figure 9)
18. To multiply or divide these
matrices simply input f*e or f/e.
(Figure 9)
These are the basic calculations that can be preformed on MATLAB. The next
part of the instructions will teach you how to graph/ plot on MATLAB.