Difficulty when constructing a Jacobian matrix

Dear Colleagues,

I am currently building up a model for forecasting. The model is
getting fairly large and suddenly I got the following error message.
(DYNARE was working just fine with a smaller model and once I added
one new parameter, this error message poped up.)

??? Subscript indices must either be real positive integers or logicals.

Error in ==> dr1 at 139
b = jacobia_(:,k0);

I can guess that there is something wrong with k0, but wasn’t able
to pin down what I miscoded. Have any of you encountered a similar
error message in the past? I will greatly appreciate if you could share
your experience in overcoming this error message.

Thank you very much in advance.


I do get the same error msg as you. For me the problem occured when I made a variable pre-determined, say, due to time to plan. The lines that I suspect cause the problem (at least in my case), is of the type

kb(-2)=log(constant) + q + I ;

So, I don’t have an answer to your question, just a similar unsolved problem.


Thank you very much, Karl.
Jcaro, who is also a participant to this forum, pointed me out the same
thing as you have mentioned. I returned to my code and checked for the
timing (especially capital accumulation), but wasn’t able to fix the bug.

Funny thing is when I reduce the number of parameters, this problem
goes away. But adding (even an innocuous one), this error message
pops out. I am not sure how the number of the parameters can affect
the size of Jacobian matrix.

But thanks for your comment. I appreciate your kindness.