MATLAB: Error using solve command of symbolic toolbox

economicssymbolic toolbox

I wrote a code to get a solution for the DSGE model I am working on but the S function was empty at first (when I trying to get the solution using sectors by sector) then later I had this error (when I wrote the whole equation at a go): Error using sym>checkindex (line 2429) Index must be a positive integer or logical.
Error in sym>privformatscalar (line 2376) checkindex(x);
Error in sym>privformat (line 2360) s = privformatscalar(x);
Error in sym/subsref (line 1578) [inds{k},refs{k}] = privformat(inds{k});
Please I need a genuine help. Thank you 🙂

Best Answer

Your expression includes k(-1) and ppb(-1) which are attempts to access arrays at index negative one.