In this tutorial, we will learn about Octave Functions.
We can define functions in separate external files or interactively in the command window. Octave functions can be:
- Built-In Functions
- User-defined Functions
Some Octave built-in functions are listed here:
The function syntax is shown below:
function return_value = name(arguments_list)
The function_body consists of Octave statements.
To create a new function click the following menu option:
File >> New >> New Function…
Enter the new function name. Octave would create the filename with the .m extension. For example, the function Foo would be created in Foo.m function file.
The file would open in the Editor pane. We can edit and the function body and save the file.
function retval = Foo (input1, input2)
fprintf(‘Foo Function \n’);
Octave Tutorial on this website can be found at:
More information on Octave can be found on the official website: