GNU Octave

Article ID: 535
Last updated: 13 Jan, 2019

GNU Octave is an open-source program that you can use as an alternative to MATLAB. Its basic numerical functions are very similar to MATLAB, in terms of appearance and usage. Also, because the Octave language is similar to MATLAB, most MATLAB programs should be able to run on Octave. However, Octave toolboxes are different from MATLAB toolboxes. If you rely on any of the MATLAB toolboxes, you may not want to switch to Octave (or, you can make an appropriate modification).

For detailed information about Octave, see the GNU Octave home page.

For a comparison of the two programs, see Differences Between Octave and MATLAB on the GNU Octave wiki page.

Using Octave

The latest version of Octave, Version 4.0.0, includes a graphical user interface (GUI). All of the previous versions run only with a command-line interface.

To see a list of versions available on NAS systems, run:

%> module avail octave

To check the version you are using:

%> octave --version

To access a quick help guide:

%> octave --help

If you are using Octave Version 4.0.0 but you do not want to use the GUI, add the --no-gui option:

%> octave --no-gui

For comprehensive instructions on using Octave, see the GNU Octave documentation.

Demonstration

Octave's "look and feel" is similar to MATLAB. To see a demonstration, run:

>> demo waterfall

A waterfall plot is displayed.

Note: The Octave demonstration feature is not as powerful as that of MATLAB, but it shows you the similarities between the two programs.

Example

Octave supports the same basic matrix operations and plotting as MATLAB. For example, if you run the following MATLAB code in Octave, the result will provide the same graphics as MATLAB.

MATLAB code:

x1 = -2*pi:pi/10:0; 
x2 = 2*pi:pi/10:4*pi; 
x3 = 0:pi/10:2*pi; 
[x1,x2,x3] = ndgrid(x1,x2,x3); 
z = x1 + exp(cos(2*x2.^2)) + sin(x3.^3); 
slice(z,[5 10 15], 10, [5 12]); 

Result in Octave:

Note: If there is a function in your MATLAB code that has not been implemented in Octave, a message will be displayed. For example:

warning: the 'delaunayTriangulation' function is not yet implemented in Octave

Please read `http://www.octave.org/missing.html' to learn how you can
contribute missing functionality.
warning: called from
    __unimplemented__ at line 524 column 5
error: 'delaunayTriangulation' undefined near line 1 column 6

Also read

Contact Us

General User Assistance

Security

  • Report security issues 24x7x365
  • Toll-free: 1-877-NASA-SEC (1-877-627-2732)
  • E-mail: soc@nasa.gov

User Documentation

High-End Computing Capability (HECC) Portfolio Office

NASA High-End Computing Program

Tell Us About It

Our goal is furnish all the information you need to efficiently and effectively use the HECC resources needed for your NASA computational projects.

We welcome your input on features and topics that you would like to see included on this website.

Please send us email with your wish list and other feedback.