Beruflich Dokumente
Kultur Dokumente
Michael J. Johnson
Spring 2008
Getting Started
I suggest that you have the Octave manual along with an octave session both running
simultaneously on your machine. In order to start Octave under linux, you should open a
terminal (or console) and type the command
octave
I suggest that you read the sections Preface and Introduction and work the suggested
examples so that you can get some quick experience. In the introduction, you can skip the
part about integrating diffierential equations and obtaining graphical output.
Typeset by AMS-TEX
1
2 HINTS FOR GETTING STARTED WITH OCTAVE
y=sin(x);
plot(x,y); (Note: using N=1000 will give you a more accurate plot)
I suggest that you try to become familiar with the following Octave commands (see
function index of manual):
linspace, plot, rand, size, length, zeros, ones, eye, abs, max, min, sort, who
After this, have a look at Expressions -> Arithmetic Operators to understand the
operators
+
−
∗
/
∧
\
.∗
./
.∧
The first four operators above are straightforward; while the last four are very useful, but
require some thought and experimentation to understand. As an example problem, try to
plot the function
sin(x3 )
f (x) = , 0 ≤ x ≤ 2π ( in Octave, pi = π).
1 + cos2 (x)
Next, have a look at the Polynomial Manipulations section of the Octave manual with
special attention given to the Octave commands polyval, conv, polyderiv, polyinteg.
You can try the following problem:
Example. Let f (x) = x3 − 2x + 1 and g(x) = 3x + 2, 0 ≤ x ≤ 2.
a) Plot f
b) Construct and plot h = f g. R
c) Construct and plot k = f 0 + g.
R2
d) Find 1 f (x) dx.
e) Construct and plot p = f + g (be careful: f and g have different degrees!)
Note: you’re supposed to use Octave to do everything here; don’t multiply, integrate, or
differentiate by hand.
Lastly, please read Functions and Scripts -> Script Files to learn how to write script
files. When you use Octave to solve homework problems you’ll have to write your solution
as a script file and give it to me on a diskette or via email. Under Linux, I suggest the
text editor gedit which is similar to Bill Gate’s program notepad. You start it at the
command prompt (ie inside a terminal) with the command:
gedit &
(the optional & keeps your terminal alive while gedit is running)
CS-543 3