Dynamic Systems Octave Tutorial


In this tutorial, we will cover some of the basics operations of dynamic systems using GNU Octave. GNU Octave is a programming language for scientific computation. In this context, Octave is used to solve linear and non linear problems numerically. It can also perform other numeric operations, which in their majority are compatible with Matlab (this also include the syntax).

Sistemas dinamicos

GNU Octave Installation


GNU Octave can be installed in the majority of operative systems. In this tutorial, we will use Windows. First, go to: https://www.gnu.org/software/octave. Then, click on Download. Next, select the Windows tab. From the options, select the version according with your systems architecture (32 or 64 bits). Most, computers will have a 64 bits architecture. Once downloaded, go to the file location (usually the download folder) and press right click on the file and select: Run as administrator. This will allow the installer to run with administrative privileges (if a window ask for confirmation, select yes). Once, the installer is initialized, press Next to continue. In the next window, a license agreement is displayed, click Next to continue. Now, in the next window a set of check boxes will appear, select the default options unchanged, and click Next. Now, select the default folder were Octave will be installed, you can change the location, but the default is recommended, click Next. Now, the installation will begin, it could take a little longer, so wait until is completed. Finally, before clicking on Finish, you can check or uncheck the options to run Octave and read the readme file.

Symbolic Package Installation


Once GNU Octave is installed, we need to install the Symbolic package. This package will allow us to perform symbolic calculations. These include operations such as: algebraic operations, calculus, equation solving, Fourier and Laplace transforms, variable precision arithmetic and other features. First download the package here. Open octave, and change the directory path to where the file is. For that, go to the upper bar and select Browse directories. This will open a window explorer, navigate to where you downloaded the symbolic package. Then, click on Select Folder (if the file is not displayed, don’t worry). You must now see the file on the left explorer, if not, make sure you selected the folder where the file is located.


Now on the command window type the following command: pkg install symbolic-win-py-bundle-2.8.0.tar.gz. Wait until the installation process finish.




In this example, we will use the Symbolic Package, so make sure you have everything working. First, open GNU Octave and load the Symbolic package using the command: pkg load symbolic;. Then insert the following commands:

  • syms a
  • T = [2-a,0,0,-1;-1,1-a,0,0;0,0,2-a,0;0,0,0,2-a];
  • det(T)
  • A = [2,0,0,-1;-1,1,0,0;0,0,2,0;0,0,0,2];
  • eig(A)

If you want to display the values of any variables, you can type then on the Command Window. Also, note that the (;) at the end  of each command is not mandatory, if you omit it, the result will be automatically displayed in the next line.