Matlab
version 5 is a very powerful tool useful for many kinds of mathematical tasks. For the purposes of this text, however,
Matlab 5 will be used only to solve four types of problems: polynomial curve fitting, system of algebraic equations, system of
ordinary differential equations, and nonlinear regression. This appendix serves as a quick guide to solving such problems. The
solutions were all prepared using the Student Edition of Matlab 5. Please note that the Matlab 5 software must be purchased
independently of the CDROM accompanying this book.
E.1 A Quick Tour
When Matlab is opened, the command window of the Matlab Student Edition appears:
You may then type commands at the EDU» prompt.
Throughout this appendix, different fonts are used to represent Matlab
input
and
output
, and
italics
are used to explain
function arguments.
E.1.1 Matlab's Method
Matlab
can range from acting as a calculator to performing complex matrix operations and more. All of Matlab's operations are
performed as matrix operations, and every variable is stored in Matlab's memory as a matrix even if it is only 1x1 in size.
Therefore, all Matlab input and output will be in matrix form.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentE.1.2 Punctuation
Matlab is
case sensitive
and recognizes the difference between capital and lowercase letters. Therefore, it is possible to work with
the variables "X" and "x" at the same time.
The
semicolon
and
period
play very important roles in performing calculations using Matlab. A semicolon placed at the end of a
command line will suppress restatement of that output. Matlab will still perform the command, but will not display the answer. For
example, type
beta=1+4
and Matlab will display the answer
beta =5
, but if you then type
alpha = 30/2;
,
Matlab will not
tell you the answer. To see the value of a variable, simply type the name of the variable,
alpha
and Matlab will display its value
,
alpha =15.
The command
who
can also be used to view a list of current variables:
Your variables are: alpha
beta
The period is used when
elementbyelement matrix multiplication
is performed. To perform standard matrix multiplication of
two matrices, say "A" and "B," type
A*B
.
To multiply every element of matrix "A" by 2 type
A*2
.
However, to multiply every
element of "A" with the corresponding element of "B," one must type
A.*B
.
This elementbyelement matrix multiplication will
be used for the purposes of this text.
To learn more about Matlab, type
demo
at the command prompt; to see a demo about matrix manipulations, type
matmanip
.
E.1.3 Help
Matlab
has an extensive online help program that can be accessed through the
help
command, the
lookfor
command, and by
the
helpwin
command (or by choosing help from the menu bar). By typing "help topic," for example
help log
,
Matlab
will
give an explanation of the topic.
LOG
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '11
 kmn
 matlab

Click to edit the document details