Generally useful matlab programs