Changes
I am pretty sure this was a bug. In Octave, it threw a warning, in matlab it threw an error. Makes sense from the code now and also works. Still needs to be checked though