Page 14 - Numerical Analysis Using MATLAB and Excel
P. 14
Chapter 1
Introduction to MATLAB
T his chapter is an introduction of the basic MATLAB commands and functions, procedures
for naming and saving the user generated files, comment lines, access to MATLAB’s Editor/
Debugger, finding the roots of a polynomial, and making plots. Several examples are pro-
vided with detailed explanations. Throughout this text, a left justified horizontal bar will denote
the beginning of an example, and a right justified horizontal bar will denote the end of the exam-
ple. These bars will not be shown whenever an example begins at the top of a page or at the bot-
tom of a page. Also, when one example follows immediately after a previous example, the right
justified bar will be omitted.
1.1 Command Window
To distinguish the screen displays from the user commands, important terms and MATLAB func-
tions, we will use the following conventions:
Click: Click the left button of the mouse
Courier Font: Screen displays
Helvetica Font: User inputs at MATLAB’s command window prompt EDU>> *
Helvetica Bold: MATLAB functions
Bold Italic: Important terms and facts, notes, and file names
When we first start MATLAB, we see the toolbar on top of the command screen and the prompt
EDU>>. This prompt is displayed also after execution of a command; MATLAB now waits for a
new command from the user. We can use the Editor/Debugger to write our program, save it, and
return to the command screen to execute the program as explained below.
To use the Editor/Debugger:
1. From the File menu on the toolbar, we choose New and click on M−File. This takes us to the
Editor Window where we can type our script (list of statements) for a new file, or open a previ-
ously saved file. We must save our program with a file name which starts with a letter. Impor-
tant! MATLAB is case sensitive, that is, it distinguishes between upper− and lower−case let-
ters. Thus, t and T are two different characters in MATLAB language. The files that we create
are saved with the file name we use and the extension .m; for example, myfile01.m. It is a good
* EDU>> is the MATLAB prompt in the Student Version.
Numerical Analysis Using MATLAB® and Excel®, Third Edition 1−1
Copyright © Orchard Publications