function [xwght] = zgn_rescalx( xwght, x, xthrsh, rescalx)
%
%  M-function zgn_rescalx set the intermediate weighting vector
%  for the iterates x for NLSQ_RES and NLSQ_ERR
%
  if rescalx == 0
    xwght = max ( abs (x(:)) , xthrsh(:));
  elseif rescalx == 1
    xwght = xthrsh;
  elseif rescalx == 2
    n = length(x);
    xwght = ones(n,1);
  end
