Published online by Cambridge University Press: 05 June 2012
For small programs or rapid prototyping of ideas and methods, the commercialMATLAB® language, or its freeware alternatives, offers a practicalalternative to C++ or FORTRAN. In this book, the free GNU Octave implementationis discussed from a scientific programming perspective. After becoming familiarwith the central language constructs summarized below, the built-in Octave helpfacilities conveniently provide information on specialized, infrequentcommands.
Obtaining octave
The Windows and Mac installation packages for GNU Octave are currently located atoctave.sourceforge.net. Linux versions are available at the main Octave web sitewww.gnu.org/software/octave. When the program is installed, avariety of additional packages and the creation of a database of C++ componentsaccessible by the editor can be selected. Unless space is an issue, theseoptions should be chosen.
Command summary
(1) Running Octave. After clicking on the Octave icon, statements are entered interactivelyby typing into the resulting command window at the > prompt. An Octavesession is terminated by typing quit.
(2) System commands.To change from the startup directory (folder) to the directorythat either contains or will contain program files, type cd X:\dir1\dir2\ . . .\programDirectory, where X is the partition (logical drive) containing the desireddirectory and \dir1\dir2 . . . \programDirectory is an ordered sequence of thenames of the directories enclosing the directory, \programDirectory, in which theprogram is located. If one or more directory names contain spaces, the entire expressioncontaining these names must be surrounded by double apostrophes ("), e.g.cd "X:\My Documents". Representative operating-system commands that can beissued from the Octave prompt include mkdir directoryName, which creates thedirectory directoryName, rmdir directoryName, which removes this directory, dir or Is which display the contents of a directory, .., which moves to one directoryhigher in the directory tree, ., which represents the current directory, rename file1.1file2.2, which renames the file file1.1 to the name file2.2, and copy, which similarlycopies a file.
…
To save this book to your Kindle, first ensure no-reply@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
Find out more about the Kindle Personal Document Service.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.