http://octave.org is a free software tool for numerical analysis and visualization. The function and command syntax is very similar to MATLAB.
Note that there is no SIMULINK-like tool in Octave, but there are many simulation functions (as in Control System Toolbox in MATLAB).
Extra packages for Octave are documented on https://octave.sourceforge.io/, for example the control package which contains functions for modeling, analysis, simulation, and control of dynamic systems (similar to the Control System Toolbox in MATLAB). Information about installation and loading of packages is given at the bottom of this tutorial.
Windows in the Octave IDE (integrated development environment)
Three windows are available by default (they can be opened either via the Window menu or from tabs at the bottom of the Octave main window).
· Command Window
The command window
We try the following simple commands from the command line (the command are executed by pressing Enter):
Octave functions are vectorized, i.e. functions can be called with vectorial arguments and the function is applied to each of the elements of the vector:
All variables generated during the session are stored in the workspace. The workspace is cleared when you quit Octave. We try a few commands:
Command line help: help command. Example:
· Help menu
· Web: http://octave.org -> docs
· Google search
An Octave script is a user-written text file of name *.m containing any Octave expressions. When you run the script, all the expressions are execued automatically as if they were written on the command line individually.
You can edit a script using the inbuilt editor available in the Editor window (via the Eitor tab), or using any other text editor, e.g. Notepad.
You can run a script in several ways:
· F5 button
· Via the Run menu in the Editor window
· By typing the script name (without the file extension m) on the command line
You should use scripts even for small tasks!
Avoid using script names that are existing variables, commands or function names!
Just after tryiing to run a script, you may be asked by Octave to change the current directory of Octave to where the script is stored. Normally, you can accept the suggested change.
Matrix (or array) operations
Creating matrices. Getting matrix information:
Matrices can be used in matrix calculations. A few examples:
The dot operator implements elementwise calculations, as .* and ./ and .^.
1. Single diagram with multiple
2. Multiple plots as subplots:
Extra function packages
Extra function packages for Octave are available at
Information about listing of already installed packages and installation of new packages are given on the above web page.
As an example, open the home page of the Control package. The list of functions is opened via the function reference link on the web page.
At the start of a session, the package must be loaded into Octave with the command load package_name.
Example scripts with the Control package
The following scripts assumes that the Control package has been loaded into Octave.
1. Simulation and calculation and plotting of poles and zeros of transfer
2. Frequency response: