Installing GNU Octave for Windows

Newer versions

The information below refers to older version of Octave and is likely out-of-date. As of July 2008, you can get the latest installer for MS Windows from sourceforge. Download Octave 3.0.1 for Windows Installer. However, I no longer have a Windows computer to test this on.


Introduction

These notes explain how to install GNU Octave on MS Windows.

Mac OS X users can get octave through fink. GNU/Linux may find octave packaged for their distribution.

To get octave working, you need octave itself, the octave-forge add-on package, gnuplot, and a basic unix-like system running on top of Windows (called cygwin). Thankfully there is an installer which includes everything you need.

Downloading Octave 2.1.73 (for Windows XP)

There is a new version of the Octave for Windows Installer available from sourceforge. It is easier to install and seems to work well with Windows XP but crashed a lot on Windows 98 (at least when I tested it). If you try this newer version, you can skip ahead to Running Octave.

Downloading Octave 2.1.50a (for Windows 98)

You can download a copy from my website here: octave-2.1.50a-inst.exe (md5sum: c603039297787569a25e3eb5675b9827). You could also download this file from octave.sourceforge.net. Save this file to your desktop.

Go to your desktop and double-click on octave-2.1.50a-inst.exe. Accepting the defaults when prompted should be OK. Eventually, a MSDOS window will open and ask some questions:

STEP 3

Set Editor used by the "edit" command
The default is currently "notepad"
If you wish to use a different editor, enter the path and
filename here

Editor (currently notepad)>

It is OK to just press enter here (unless of course you want to use a different editor).

STEP 4

In order to use the epstk graphics functions, you
need to have a postscript interpreter. This would
typically be gswin or ghostscript

cmd: not found
No program is currently associated with ps files
If you have such a program installed, enter the
full path to the executable, otherwise type return
New PS viewer>

Again it is OK to just press enter here as you probably won’t need this functionality.

Running Octave

After the install is completed, you can run Octave by double-clicking on the “GNU Octave 2.1.50” icon on your desktop. Test Octave by entering the following at the Octave prompt (>>):

>> x = 0:.25:10;
>> plot(x, sin(x), 'rx-')
>> ylabel('sin(x)')    
>> xlabel('x');        
>> replot

A new window labeled “gnuplot graph” should open.

Printing a figure

Click on the icon on the left of the “gnuplot graph” window. This will bring up the gnuplot menu. From here you can print the figure (this didn’t work for me) or copy it to the clipboard. I was able to print figures by copying them to the clipboard and pasting them into my word processor.

gnuplot screenshot

Copying Text

If you highlight text in the Octave window, it will automatically be copied to the clipboard. You can then paste it into Notepad or your word processor.

Creating .m files

Octave uses .m files to store scripts and functions. When Octave starts up, it uses the following path: C:\Program Files\GNU Octave 2.1.73\octave_files so it would be easiest to store your .m files there.

For example, download the script bisection_q13.m and save it to C:\Program Files\GNU Octave 2.1.73\octave_files. You can now run the script at the Octave prompt by typing bisection_q13. This example script solves Question 13 from Section 2.1 of your textbook.

Note: if you use Notepad to open a .m file that was created on a Unix system, it will be filled with horrible little black boxes instead of newlines. You can fix this by opening the file with WordPad instead of Notepad and then saving it. After this you can open it with Notepad.