Matlab simulation code for my paper