write a matlab script for am mod