evalin('base',[ 'M_.params(' num2str(iter) ') = ' M_.param_names(iter,:) ';' ])
evalin('base',[ 'M_.params(' num2str(iter) ') = ' M_.param_names(iter,:) ';' ])
eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names(iter,:) ';' ])
StephaneAdjemian wrote:Hi Dario,
Here is an example with deterministic simulation of a growthless optimal growth model (it is exactly the same approach for stochastic models).
Note that if the steady state is only known partially the user can use a Newton like routine inside the *_steadystate.m file.
Note also that this example will run only with Dynare version 4.
Best,
Stéphane.
function [ys,check] = *_steadystate(ys,exe)
global M_ lgy_
if isfield(M_,'param_nbr') == 1
NumberOfParameters = M_.param_nbr;
for i = 1:NumberOfParameters
paramname = deblank(M_.param_names(i,:));
eval([ paramname ' = M_.params(' int2str(i) ');']);
end
check = 0;
end
%%%% Model equations to be entered here
for iter = 1:length(M_.params)
eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names(iter,:) ';' ])
end
if isfield(M_,'param_nbr') == 1
if isfield(M_,'orig_endo_nbr') == 1
NumberOfEndogenousVariables = M_.orig_endo_nbr;
else
NumberOfEndogenousVariables = M_.endo_nbr;
end
ys = zeros(NumberOfEndogenousVariables,1);
for i = 1:NumberOfEndogenousVariables
varname = deblank(M_.endo_names(i,:));
eval(['ys(' int2str(i) ') = ' varname ';']);
end
else
ys=zeros(length(lgy_),1);
for i = 1:length(lgy_)
ys(i) = eval(lgy_(i,:));
end
check = 0;
end
end
Users browsing this forum: Google [Bot] and 11 guests