matlab modvir function added for completness