Syntax Examples
The Octave syntax is largely compatible with Matlab. The Octave interpreter can be run in GUI mode, as a console, or invoked as part of a shell script. More Octave examples can be found in the wiki.
Solve systems of equations with linear algebra operations on vectors and matrices.
b = [4; 9; 2] # Column vector
A = [ 3 4 5;
1 3 1;
3 5 9 ]
x = A \ b # Solve the system Ax = bVisualize data with high-level plot commands in 2D and 3D.
x = -10:0.1:10; # Create an evenly-spaced vector from -10..10
y = sin (x); # y is also a vector
plot (x, y);
title ("Simple 2-D Plot");
xlabel ("x");
ylabel ("sin (x)");Install
Executable versions of GNU Octave for GNU/Linux systems are provided by the individual distributions. Distributions known to package Octave include Debian, Ubuntu, Fedora, Gentoo, and openSUSE. These packages are created by volunteers. The delay between an Octave source release and the availability of a package for a particular GNU/Linux distribution varies.
The Octave Wiki has instructions for installing Octave on macOS systems. Octave may also be available in third-party package managers such as Homebrew, MacPorts, or Fink.
Executable versions of Octave for BSD systems are provided by the individual distributions. Both FreeBSD and OpenBSD have Octave packages. These packages are created by volunteers. The delay between an Octave source release and the availability of a package for a particular GNU/Linux distribution varies. The Octave project has no control over that process.
Windows binaries with corresponding source code can be downloaded from https://ftp.gnu.org/gnu/octave/windows/.
The latest released version of Octave is always available from https://ftp.gnu.org/gnu/octave/.
Octave Forge
Octave Forge
is a central location for development of packages for GNU Octave,
similar to Matlab's toolboxes. To install a package, use the
pkg command from the Octave prompt by typing:
pkg install -forge package_name
pkg load package_nameDevelopment
Octave is free software licensed under the GNU General Public License (GPL). Assuming you have Mercurial installed on your machine you may obtain the latest development version of Octave sources with the following command:
hg clone http://www.octave.org/hg/octaveIf you want to participate in Octave development, join the [email protected] mailing list.
GNU Octave 4.2.0 Released
GNU Octave version 4.2.0 has been released and is now available for download. An official Windows binary installer is available. For macOS see the installation instructions in the wiki.