Converted to Matlab from Scilab

No fixes to the model yet.