Skip to content
Snippets Groups Projects
Select Git revision
  • d10242fbabbb09f4edce368bb11a81d929f1a9b6
  • master default
  • nlf-fixes
  • newton-quadratic-equation-solver
  • nlf-fixes-r
  • nls-fixes
  • sep-fixes
  • sep
  • use-dprior
  • ep-sparse
  • rebase-1
  • parfor
  • reset-seed-in-unit-tests
  • remove-persistent-variables
  • nonlinear-filter-fixes
  • pac-mce-with-composite-target
  • 6.x
  • dprior
  • covariance-quadratic-approximation
  • benchmark-ec
  • kalman_mex
  • 5.5
  • 5.4
  • 5.3
  • 5.2
  • 5.1
  • 5.0
  • 5.0-rc1
  • 4.7-beta3
  • 4.7-beta2
  • 4.7-beta1
  • 4.6.4
  • 4.6.3
  • 4.6.2
  • 4.6.1
  • 4.6.0
  • 4.6.0-rc2
  • 4.6.0-rc1
  • 4.6-beta1
  • 4.5.7
  • 4.5.6
41 results

check_name.m

Blame
  • Forked from Dynare / dynare
    Source project has a limited visibility.
    UnivariateSpectralDensity.m 5.44 KiB
    function [omega,f] = UnivariateSpectralDensity(dr,var_list)
    % This function computes the theoretical spectral density of each
    % endogenous variable declared in var_list. Results are stored in 
    % oo_ and may be plotted. Plots are saved into the graphs-folder.
    % 
    % Adapted from th_autocovariances.m.  
    
    % Copyright (C) 2006-2013 Dynare Team
    %
    % This file is part of Dynare.
    %
    % Dynare is free software: you can redistribute it and/or modify
    % it under the terms of the GNU General Public License as published by
    % the Free Software Foundation, either version 3 of the License, or
    % (at your option) any later version.
    %
    % Dynare is distributed in the hope that it will be useful,
    % but WITHOUT ANY WARRANTY; without even the implied warranty of
    % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % GNU General Public License for more details.
    %
    % You should have received a copy of the GNU General Public License
    % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
    
    global options_ oo_ M_
    
    
    omega = []; f = [];
    
    if options_.order > 1
        disp('UnivariateSpectralDensity :: I Cannot compute the theoretical spectral density') 
        disp('with a second order approximation of the DSGE model!')
        disp('Please set order = 1. I abort')
        return
    end
    pltinfo  = options_.SpectralDensity.plot; 
    cutoff   = options_.SpectralDensity.cutoff; 
    sdl      = options_.SpectralDensity.sdl; 
    omega    = (0:sdl:pi)';
    GridSize = length(omega);
    exo_names_orig_ord  = M_.exo_names_orig_ord;
    if isoctave
        warning('off', 'Octave:divide-by-zero')
    else
        warning off MATLAB:dividebyzero
    end
    if nargin<2
        var_list = [];
    end
    if size(var_list,1) == 0
        var_list = M_.endo_names(1:M_.orig_endo_nbr, :);
    end
    nvar = size(var_list,1);
    ivar=zeros(nvar,1);
    for i=1:nvar
        i_tmp = strmatch(var_list(i,:),M_.endo_names,'exact');
        if isempty(i_tmp)
            error (['One of the variables specified does not exist']) ;
        else
            ivar(i) = i_tmp;
        end
    end
    f = zeros(nvar,GridSize);
    ghx = dr.ghx;
    ghu = dr.ghu;
    nspred = M_.nspred;
    nstatic = M_.nstatic;
    kstate = dr.kstate;
    order = dr.order_var;
    iv(order) = [1:length(order)];