Home > matlab > simul.m

simul

PURPOSE ^

Computes deterministic simulations

SYNOPSIS ^

function simul

DESCRIPTION ^

 Computes deterministic simulations
  
 INPUTS
   None
  
 OUTPUTS
   none
    
 ALGORITHM
   
 SPECIAL REQUIREMENTS
   none

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function simul
0002 % Computes deterministic simulations
0003 %
0004 % INPUTS
0005 %   None
0006 %
0007 % OUTPUTS
0008 %   none
0009 %
0010 % ALGORITHM
0011 %
0012 % SPECIAL REQUIREMENTS
0013 %   none
0014 
0015 % Copyright (C) 1996-2012 Dynare Team
0016 %
0017 % This file is part of Dynare.
0018 %
0019 % Dynare is free software: you can redistribute it and/or modify
0020 % it under the terms of the GNU General Public License as published by
0021 % the Free Software Foundation, either version 3 of the License, or
0022 % (at your option) any later version.
0023 %
0024 % Dynare is distributed in the hope that it will be useful,
0025 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0026 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0027 % GNU General Public License for more details.
0028 %
0029 % You should have received a copy of the GNU General Public License
0030 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0031 
0032 global M_ options_ oo_
0033 
0034 test_for_deep_parameters_calibration(M_);
0035 
0036 if options_.stack_solve_algo < 0 || options_.stack_solve_algo > 5
0037     error('SIMUL: stack_solve_algo must be between 0 and 5')
0038 end
0039 
0040 if ~options_.block && ~options_.bytecode && options_.stack_solve_algo ~= 0
0041     error('SIMUL: you must use stack_solve_algo=0 when not using block nor bytecode option')
0042 end
0043 
0044 if options_.block && ~options_.bytecode && options_.stack_solve_algo == 5
0045     error('SIMUL: you can''t use stack_solve_algo = 5 without bytecode option')
0046 end
0047 
0048 if exist('OCTAVE_VERSION') && options_.stack_solve_algo == 2
0049     error('SIMUL: you can''t use stack_solve_algo = 2 under Octave')
0050 end
0051 
0052 if size(M_.lead_lag_incidence,2)-nnz(M_.lead_lag_incidence(M_.maximum_endo_lag+1,:)) > 0
0053     mess = ['SIMUL: error in model specification : variable ' M_.endo_names(find(M_.lead_lag_incidence(M_.maximum_lag+1,:)==0),:)] ;
0054     mess = [mess ' doesn''t appear as current variable.'] ; 
0055     error (mess) ;
0056 end
0057 
0058 if options_.periods == 0
0059     error('SIMUL: number of periods for the simulation isn''t specified')
0060 end
0061 
0062 if ~ options_.initval_file
0063     if ~isfield(options_,'datafile')
0064         make_ex_;
0065         make_y_;
0066     else
0067         read_data_;
0068     end
0069 end
0070 
0071 if isempty(options_.scalv) || options_.scalv == 0
0072     options_.scalv = oo_.steady_state ;
0073 end
0074 
0075 options_.scalv= 1 ;
0076 
0077 if(options_.block)
0078     if(options_.bytecode)
0079         [info, oo_.endo_simul] = bytecode('dynamic');
0080         mexErrCheck('bytecode', info);
0081     else
0082         eval([M_.fname '_dynamic']);
0083     end;
0084 else
0085     if(options_.bytecode)
0086         [info, oo_.endo_simul]=bytecode('dynamic');
0087         mexErrCheck('bytecode', info);
0088     else
0089         if M_.maximum_endo_lead == 0
0090             error('SIMUL: purely backward models are not supported')
0091         elseif M_.maximum_endo_lag == 1 && M_.maximum_endo_lead == 1
0092         sim1 ;
0093         else % For purely forward models
0094             simk;
0095         end;
0096     end;
0097 end;
0098 
0099 dyn2vec;

Generated on Tue 22-May-2012 02:40:23 by m2html © 2005