Page 12 - Applied Numerical Methods Using MATLAB
P. 12
1
MATLAB USAGE AND
COMPUTATIONAL ERRORS
1.1 BASIC OPERATIONS OF MATLAB
MATLAB is a high-level software package with many built-in functions that
make the learning of numerical methods much easier and more interesting. In
this section we will introduce some basic operations that will enable you to
learn the software and build your own programs for problem solving. In the
workstation environment, you type “matlab” to start the program, while in the
PC environment, you simply double-click the MATLAB icon.
Once you start the MATLAB program, a Command window will open with the
MATLAB prompt >>. On the command line, you can type MATLAB commands,
functions together with their input/output arguments, and the names of script files
containing a block of statements to be executed at a time or functions defined
by users. The MATLAB program files must have the extension name ***.m to
be executed in the MATLAB environment. If you want to create a new M-file
or edit an existing file, you click File/New/M-file or File/Open in the top left
corner of the main menu, find/select/load the file by double-clicking it, and then
begin editing it in the Editor window. If the path of the file you want to run
is not listed in the MATLAB search path, the file name will not be recognized
by MATLAB. In such cases, you need to add the path to the MATLAB-path
list by clicking the menu ‘File/Set Path’ in the Command window, clicking the
‘Add Folder’ button, browsing/clicking the folder name, and finally clicking the
SAVE button and the Close button. The lookfor command is available to help
you find the MATLAB commands/functions which are related with a job you
Applied Numerical Methods Using MATLAB , by Yang, Cao, Chung, and Morris
Copyright 2005 John Wiley & Sons, Inc., ISBN 0-471-69833-4
1