# Octave script as limit-state function

The latest release of STRUREL offers an external interface to Octave – besides the already existing external interfaces to Matlab, Python, Maple, Mathematica and Ruby.

As most Matlab scripts can directly be run with Octave, we can directly use the Matlab example as demonstration example. The only difference is that `matlabs` needs to be replaced with `ocataves`. The full application example is presented in the following:

We use the example limit-state function RS that we already used for the Matlab example: Our stochastic model consists of the two random variables R and S, where R represents the resistance of a system of interest and S is the system load. The symbolic expression for the corresponding limit-state function in the native syntax of STRUREL would be:`FLIM(1) = R-S`

However, if you have Octave installed on your system and if the Octave interface of STRUREL is configured correctly, you could also use the following expression:

`FLIM(1) = octaves("my_model")`

where `my_model.m` is an Octave script file located in the same directory as the iti-file of STRUREL.

For the example at hand, the Octave script file should look as follows:

`function [lsfval] = my_model(INPUT)R = INPUT(1);S = INPUT(2);lsfval = R - Send`

The ordering of the random variables in the vector `INPUT` corresponds to the order in which they appear in the stochastic model of STRUREL.

Alternatively, the Octave script file could look as follows:

`function [lsfval] = my_model(INPUT)global R;global S;lsfval = R - Send`

where the variable names R and S must match the names of the random variables of the stochastic model of STRUREL.

By means of the STRUREL command `octaves`, you can integrate any limit-state function written in Matlab/Octave-Syntax directly in your reliability analysis performed with STRUREL.