There is either a timing problem or a problem with the setup. Something that might be relevant is the sectoral structure. See [Timing of capital in two sector economy)
In general, you might want to start with a simpler version of the model that works and then start adding features.
Thank you for your reply, I have tried a simpler version, and it works. But if I consider another sector, timing problems will appear. I’m confused that the economy’s aggregate capital is simply: k = kT + kN. kT= (1-delta)*kT(-1) + iT and KN=(1-delta)*kN(-1) + iN written in Dynare language, so i want to ask if the aggregate capital k is a predetermined variable?
Also hope you can give me a code of two sector model with capital for reference.
No, in your example aggregate capital is not predetermined, because we are talking about a simple definition here. Of course, the aggregate capital stock will be implicitly predetermined, because its components are already predetermined, but you don’t have to define it as such here.
Sorry, I don’t have an example (yet).