roughly the matlab script can be freezed now