matlab generate, test functions