Hi, I am trying to simulate a Ramsey-Kass-Koopmans model that has deterministic growth and plot process of convergence to steady state. I can compute the de-trended steady state easily, however plotting the actual convergence I haven’t yet figured out. My code currently reads:

```
%%file Dynare_model\NGM\NGM_approx.mod
@#define periods=100
parameters beta delta gamma alpha g;
periods = @{periods};
varexo Z;
%trend_var(growth_factor=1+g) Z;
% Equation is: k'=A^(1-alpha) k^alpha -c +(1-delta-g)k
% if we normalize, divide by A:
%var(deflator=Z) k;
%var(deflator=Z) c;
var k;
var c;
beta = 0.98;
delta = 0.01;
alpha = 0.3;
gamma = 2.0;
g=0.05;
model;
(c)^(1-gamma)/c = beta*((c(+1))^(1-gamma)/c(+1))*(1+alpha*Z(-1)^(1-alpha)*k(-1)^(alpha)/k(-1)-delta-g);
k = Z(-1)^(1-alpha)*k(-1)^alpha - c + (1-delta-g)*k(-1);
end;
initval;
k = 0.7;
c = 1.0;
end;
shock_vals_Z = cumprod((1+g)*ones(@{periods},1));
shocks;
var Z;
periods 1:@{periods};
values (shock_vals_Z);
end;
endval;
Z = 1*(1+g)^(@{periods}+1);
k =Z*(1+g)*(delta+g)^(1/alpha-1);
end;
steady(solve_algo=1);
stoch_simul(periods=@{periods});
%perfect_foresight_setup(periods=@{periods});
%perfect_foresight_solver;
rplot k c;
```

any suggestions?