debugged some more, added matlab plotting