function y = erfcx(x)
%ERFCX  Scaled complementary error function.
%   Y = ERFCX(X) is the scaled complementary error function for each
%   element of X.  X must be real.  The scaled complementary error
%   function is defined as: 
%
%     erfcx(x) = exp(x^2) * erfc(x)
%
%   which is approximately (1/sqrt(pi)) * 1/x for large x.
%
%   See also ERF, ERFC, ERFINV.

%   Copyright 1984-2000 The MathWorks, Inc. 
%   $Revision: 5.8 $  $Date: 2000/06/01 15:14:03 $

% Derived from a FORTRAN program by W. J. Cody.

if ~isreal(x), error('X must be real.'); end
siz = size(x);
x = x(:);
y = reshape(erfcore(x,2),siz);

