% test_jac.m - evaluate Jacobian by numerical partial derivatives
%   used for ME 581 web cutter
% HJSIII, 08.04.02

% hold estimates for generalized coordinates
nq = length(q);
qhold = q;

% evaluate constraints
wc_phi

% hold constraints
phold = PHI;

% perturb one coordinate at a time
for iq = 1:nq,
  q = qhold;
  q(iq) = q(iq) + 0.01;

% change in constraints caused by coordinate perturbation is
% approximately equal to partial derivative
  wc_phi
  jtest(:,iq) = ( PHI - phold ) / 0.01;
end

% reset coordinates and constraints
q = qhold;
wc_phi

