next up previous contents
Next: First Order ODEs Symbolically Up: Infant MATLAB Previous: Some MATLAB commands   Contents

init.m Line-by-Line

init.m contains variable assignments and one actual command. Each of these lines could also be individually entered by hand at the command prompt. (The symbol % tells MATLAB to ignore everything else that follows on that particular line. It usually indicates a comment/description inserted by the author of the M-file.)
N=20; $\textstyle \parbox{14.5cm}{Creates the
variable {\tt N} and assigns it the num...
...formation to the screen.
Try entering just {\tt N=20} to see the difference.)}$
ftx='2*t*x'; $\textstyle \parbox{13cm}{Creates the
variable {\tt ftx} and assigns it the str...
... but
has several advantages. The symbol \lq\lq {\tt *}'' refers to multiplication.}$
initax=[-2,2,-2,2]; $\textstyle \parbox{12cm}{
Creates the variable {\tt initax} and assigns it the...
...\tt [-2,2,-2,2]}. Row elements can be separated by either a
comma or a space.}$
ax=initax; $\textstyle \parbox{13cm}{Creates the
variable {\tt ax} and assigns it whatever value the variable
{\tt initax} has.}$
axis(ax) $\textstyle \parbox{14cm}{{\tt axis} is
a standard MATLAB command that sets the...
... [-2,2,-2,2]}. This
command will also open a figure window if none is active.}$

$\textstyle \parbox{15cm}{Creates the variable {\tt t} and assigns it the
...r to the first and second elements of the row-vector {\tt ax},
respectively. }$
t0=1.0932; x0=0.95208; $\textstyle \parbox{10.5cm}{
Creates the variables {\tt t0, x0} and assigns them the number values
1.0932 and 0.95208.}$
C=0.28817; $\textstyle \parbox{14cm}{Creates the
variable {\tt C} and assigns it the number value 0.28817.}$
ftxsln='C*exp(t$\wedge$2)'; $\textstyle \parbox{11cm}{ Creates the variable {\tt ftxsln} and assigns it
...heses in its call not square brackets. This is true for all
MATLAB functions.}$

Michael Renardy