⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fdjac.m

📁 计量工具箱
💻 M
字号:
function fjac = fdjac(f,x,varargin)% PURPOSE: Computes two-sided finite difference Jacobian% -------------------------------------------------------% Usage: fjac = fdjac(func,x,varargin)% Where: func = name of function of form fval = func(x)%           x = vector of parameters (n x 1)%    varargin = optional arguments passed to the function% -------------------------------------------------------% RETURNS:%        fjac = finite differnce Jacobian% -------------------------------------------------------% See also: fdhess, hessian% -------------------------------------------------------        % Code from:% COMPECON toolbox [www4.ncsu.edu/~pfackler]% documentation modified to fit the format of the Ecoometrics Toolbox% by James P. LeSage, Dept of Economics% University of Toledo% 2801 W. Bancroft St,% Toledo, OH 43606% jlesage@spatial-econometrics.comeps = 1e-5;h = eps^(1/3)*max(abs(x),1);for j=1:length(x);   x1 = x; x1(j) = x(j) + h(j);   x0 = x; x0(j) = x(j) - h(j);   fjac(:,j) = (feval(f,x1,varargin{:})-feval(f,x0,varargin{:}))/(x1(j)-x0(j));end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -