Agent modeling in Matlab