resid displays the name of the equations if they are specified in equations tags.
parent
ffaec7ba89
commit
618f72bc91
|
@ -31,6 +31,20 @@ function z = resid(junk)
|
|||
|
||||
global M_ options_ oo_
|
||||
|
||||
tagname = 'name';
|
||||
if nargin && ischar(junk)
|
||||
tagname = junk;
|
||||
end
|
||||
|
||||
|
||||
tags = M_.equations_tags;
|
||||
istag = 0;
|
||||
if length(tags)
|
||||
istag = 1;
|
||||
end
|
||||
|
||||
|
||||
|
||||
steady_state_old = oo_.steady_state;
|
||||
|
||||
% If using a steady state file, initialize oo_.steady_state with that file
|
||||
|
@ -80,19 +94,31 @@ else
|
|||
oo_.exo_det_steady_state], M_.params);
|
||||
end
|
||||
|
||||
|
||||
% Display the non-zero residuals if no return value
|
||||
if nargout == 0
|
||||
for i = 1:4
|
||||
disp(' ')
|
||||
end
|
||||
|
||||
disp('Residuals of the static equations:')
|
||||
disp(' ')
|
||||
for i=1:M_.orig_endo_nbr
|
||||
if abs(z(i)) < options_.dynatol/100
|
||||
tmp = 0;
|
||||
else
|
||||
tmp = z(i);
|
||||
end
|
||||
disp(['Residual for equation number ' int2str(i) ' is equal to ' num2str(tmp)])
|
||||
if istag
|
||||
tg = tags(cell2mat(tags(:,1)) == i,2:3); % all tags for equation i
|
||||
ind = strmatch( tagname, cellstr( tg(:,1) ) );
|
||||
end
|
||||
if length(ind) == 0 || ~istag
|
||||
disp(['Equation number ' int2str(i) ' : ' num2str(tmp)])
|
||||
else
|
||||
t1 = tg( ind , 2 );
|
||||
s = cell2mat(t1);
|
||||
disp( ['Equation number ', int2str(i) ,' : ', num2str(tmp) ,' : ' s])
|
||||
end
|
||||
end
|
||||
for i = 1:2
|
||||
disp(' ')
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
function [indices] = select_from_table(table,key,value)
|
||||
% Copyright (C) 2010 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/>.
|
||||
candidates = table(strmatch(key,table(:,2),'exact'),:);
|
||||
if nargin == 2
|
||||
indices = cell2mat( candidates(:,1) );
|
||||
return;
|
||||
end
|
||||
indices = candidates(strmatch(value, candidates(:,3), 'exact'),1);
|
||||
indices = cell2mat(indices);
|
Loading…
Reference in New Issue