###
Arguments

####
X

An *
n*
-element integer, single-, or double-precision floating-point vector. Note that the *
X*
vector must be sorted into ascending order.

####
Y

An *
n*
-element integer, single-, or double-precision floating-point vector. Note that the elements of the *
Y *
vector must be paired with the appropriate elements of *
X*
.

###
Example

Define two *
n*
-element vectors of paired data.

X = [-3.20, 4.49, -1.66, 0.64, -2.43, -0.89, -0.12, 1.41, $

2.95, 2.18, 3.72, 5.26]

Y = [-7.14, -1.30, -4.26, -1.90, -6.19, -3.98, -2.87, -1.66, $

-0.78, -2.61, 0.31, 1.74]

Sort the X values into ascending order, and sort the Y values to match the new order of the elements in X:

XX = X(SORT(X))

YY = Y(SORT(X))

Compute the model parameters, *
A*
and *
B*
.

PRINT, LADFIT(XX, YY)

IDL prints:

-3.15301 0.930440