Use of Surf command in dynare

I am getting an error in the surf command in the code used when we provide a loop structure to the stoch_simul command. Could anyone help in rectifying the mod file provided below.
Irelandexp.mod (1002 Bytes)

Use

var y, x, g, r, pi, a, e, z ;
varexo eps_r, eps_a, eps_e, eps_z ;
parameters beta, omega, psi, rho_pi, rho_g, rho_x, rho_a, rho_e,
sig_r, sig_z, sig_a, sig_e ;
beta = 0.99 ;
omega = 0.0617 ;
rho_pi = 0.3597 ;
rho_g = 0.0000 ;
rho_x = 0.0347 ;
rho_a = 0.9470 ;
rho_e = 0.9625 ;
sig_a = 0.0405 ;
sig_e = 0.0012 ;
sig_z = 0.0109 ;
sig_r = 0.0031 ;

psi=0;

model (linear) ;
x = x(+1) - ( r - pi(+1) ) + ( 1 - omega ) * ( 1 - rho_a ) * a ;
pi = beta * pi(+1) + psi * x - e ;
r = r(-1) + rho_pi * pi + rho_g * g + rho_x * x + eps_r ;
x = y - omega * a ;
g = y - y(-1) + z ;
a = rho_a * a(-1) + eps_a ;
e = rho_e * e(-1) + eps_e ;
z = eps_z ;
end;
resid;
steady;
check;
shocks ;
var eps_a = sig_a^2 ;
var eps_e = sig_e^2 ;
var eps_z = sig_z^2 ;
var eps_r = sig_r^2 ;
end;

stoch_simul(noprint, nograph);

verbatim;
psi_params=0:0.05:1;
pi_eps_a_mat=NaN(options_.irf,length(psi_params));

for i=1:length(psi_params)
    set_param_value('psi',psi_params(i));
    [info, oo_, options_, M_] = stoch_simul(M_, options_, oo_, var_list_);
    if info(1)~=0
        warning('Invalid draw')
    else
        pi_eps_a_mat(:,i) = pi_eps_a;
    end
end;

surf(pi_eps_a_mat(1:5,:)); xlabel('\psi'); ylabel('t'); zlabel('\pi');

end;

Thank you Sir for guiding me. I tried the above modification as suggested by you above. I ran the program and got this error:

Error using stoch_simul
Too many input arguments.

Error in Ireland_dynare (line 200)
[info, oo_, options_, M_] = stoch_simul(M_, options_, oo_, var_list_);

Error in dynare (line 235)
evalin(‘base’,fname) ;

Are you using Dynare 5.2?

I am using an older version 4.5

Then please upgrade.

Thank you so much sir. I upgraded and the file is running now