Do not name a variable "error". "error" is a key MATLAB facility name.
It is not permitted to index a variable at location 0, so x(0) is illegal.
Your code is not MATLAB code, it is Octave or SciLab code.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!