If you save that code into one single file and want to execute that, you have
to indicate that it should be run as a script. This can be done by simply
adding a line with "1;" before your function definition. Otherwise, Octave
will try to execute your file as a function and will be missing its input
arguments. Hence the error you are seeing.