Some (maybe) useful matlab codes