Sample Code to simulate a DSGE model with regime switching

Hi, Guys:
I want to learn the technique of modelling regime switching, including simultation and estimation. Do you know any place I can find some sample code to read ? It is better to be written in Matlab or Gauss. I have very limited knowledge in Fortran or C.
I want to learn the technique of modelling regime switching, including simultation and estimation. Do you know any place I can find some sample code to read ? It is better to be written in Matlab or Gauss. I have very limited knowledge in Fortran or C.