%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % function quad(xx,h,para,'u') % % makoto nakajima, October 11,1999 % % This routine culculate quadratic approximation of the function 'u' % around steady state xs. % % This program is translated from GAUSS program of Gary Hansen % % % locally use : i,j,n,q,z,hz % inputs : u (function to be approximated) % xx (point at which the function is approximated) % h (a small positive number) % para(parameters in f) % output : r_matrix % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function[r_matrix]=vquad(xx,h,para,u) n=length(xx); q=zeros(n+1,n+1); hz=abs(h*xx); for i=1:n z(i,i)=hz(i); if hz(i)==0 z(i,i)=h; end end i=1; while i<=n q(i+1,i+1)=((feval(u,xx+z(:,i)',para)+feval(u,xx-z(:,i)',para))/2-feval(u,xx,para))/z(i,i)^2; j=1; while j