How to solve the error of "syntax error, unexpected $end" when estimating

eg1.mod (1.1 KB)

Your code is not a mod-file, but just Matlab code. You cannot run it in Dynare.