adding matlab versions of code.

everything looks good with the C++...