added previous matlab work