Error using log Too many input arguments

Can someone please provide me direction?

I am getting the following error message when I code an RBC model with labor and investment adjustment costs.

Error using log
Too many input arguments.
Error in Ch1Modelv7 (line 174)
M_.NNZDerivatives(1) = 72;
Error in dynare (line 185)
evalin(‘base’,fname) ;

This is a very strange Matlab (not Dynare) bug. I will file a bug report with Matlab. The reason seems to be that in your initval-block you define

which is a negative number. Then in the next line you use

y = alpha*log(k)+(1-alpha)*log(n);
You take the log of n, which is negative and results in a complex number.

Thank you Johannes for the direction. It is very helpful.

I got feedback from Mathworks. The error message about a wrong line is a bug associated with the Matlab accelerator (and is still present in 2014b). Putting

resolves the problem and will provide correct output, but it will come at a performance cost. Mathworks will fix this in a future version.