# Dynare\_simul in version 4.2 not working anymore

**URL:** <https://forum.dynare.org/t/dynare-simul-in-version-4-2-not-working-anymore/1707>\
**Category:** Dynare contributions and examples\
**Created:** [20 October 2010 15:23 UTC](https://forum.dynare.org/t/dynare-simul-in-version-4-2-not-working-anymore/1707 "2010-10-20T15:23:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lombard](https://forum.dynare.org/letter_avatar_proxy/v4/letter/l/ecb155/32.png) [@lombard](https://forum.dynare.org/u/lombard)\
**Post date:** [20 October 2010 15:23 UTC](https://forum.dynare.org/t/dynare-simul-in-version-4-2-not-working-anymore/1707/1 "2010-10-20T15:23:29Z")

</div>

Hi,

I’ve compiled dynare 4.2-unstable few weeks ago. The function dynare\_simul has been changed (since previous 4.2 download)

Now it is not working as it seems to need 12 (!) inputs rather than the usual (min) 2.

The comment on the code still refers to

```auto
% SYNOPSIS
% 
% [err, r] = dynare_simul(name, shocks)
% [err, r] = dynare_simul(name, prefix, shocks)
% [err, r] = dynare_simul(name, shocks, start)
% [err, r] = dynare_simul(name, prefix, shocks, start)
```

while later on you find

```auto
if nargout ~= 2 || nargin < 12
    error('dynare_simul_ must have at least 12 input parameters and exactly 2 output arguments.');
end
```

Also, why does dynare\_simul (old and new) give a seed to the simulation function?

Best

Gianni

---

<div class="post-metadata">

**Author:** ![lombard](https://forum.dynare.org/letter_avatar_proxy/v4/letter/l/ecb155/32.png) [@lombard](https://forum.dynare.org/u/lombard)\
**Post date:** [20 October 2010 15:56 UTC](https://forum.dynare.org/t/dynare-simul-in-version-4-2-not-working-anymore/1707/2 "2010-10-20T15:56:03Z")

</div>

I think I see the problem,

The output of the new code has been changed. Now (strangely) the first output is a zero (assigned at bottom of file) while the second is the simulated series.

This is not the true problem though. The call to the mex function is wrong.  
It is

```auto
command = 'r=dynare_simul_(' num2str(order-1) ',nstat,npred,nboth,nforw,' ...
           'nexog,ystart,shocks,vcov_exo,seed,ss' derstr ');'];
```

and should be

```auto
command = '[err,r]=dynare_simul_(' num2str(order-1) ',nstat,npred,nboth,nforw,' ...
           'nexog,ystart,shocks,vcov_exo,seed,ss' derstr ');'];
```

So the initial input/output check is misplaced (at that stage no need for 12 inputs)  
I suspect that there is no need to force two outputs either (the first being always zero).

The only needed change in dynare\_simul is the two-output version of the call to the mex function

Best

Gianni
