some code to compare to matlab output