Jump to content

GNU Octave

From Wikiversity
The GNU Octave GUI workspace running on Linux.

GNU Octave is a free-as-in-freedom mathematical software package and a programming language, with considerable compatibility with MATLAB, a proprietary package. This page complements Wikipedia and Wikibooks. It should help readers who want to learn GNU Octave rather than just read about it. For a start, the page collects links to learning materials outside of Wikiversity.

Getting started

[edit | edit source]

To get started, one can use Octave Online, avoiding the need to install Octave. Using that environment, one can peruse Using Octave from octave.org, try the examples and modify them. One can then move to the Octave Programming Tutorial in Wikibooks and solve the exercises that it has.

A few quick examples:

octave:1> sin(3)
ans = 0.1411
  • Evaluates an expression and outputs the result.
octave:2> x = 0:0.1:7; plot (x, sin (x));
  • Plots sine function on the given range, with the given step of 0.1.
octave:3> plot(x, sin(x), x, cos(x));
  • Building on the above, plots multiple functions.
octave:4> m = [1, 1, 2; 3, 5, 8; 13, 21, 34]
m =

    1    1    2
    3    5    8
   13   21   34
  • Creates a matrix.

Notes: the ";" character at the end of a line suppresses text output and the "plot" function opens a new window containing a graph.

Compatibility with MATLAB

[edit | edit source]

As per octave.org, "The Octave syntax is largely compatible with Matlab."[1] Moreover, differences between Octave and MATLAB are usually considered to be bugs. [2]

Links:

References

[edit | edit source]
  1. ↑ GNU Octave
  2. ↑ Differences between Octave and Matlab, wiki.octave.org

Further reading

[edit | edit source]

Wikipedia and Wikibooks:

Official pages and documentation from octave.org:

YouTube:

Other: