;returns the coefficients of a polynomial fitted to the
;curve defined by x and y
;the order of the polynomial is the number of points in x and y
function n_interpolate, x, y
x=reform(x)
y=reform(y)
npts=min([n_elements(x), n_elements(y)])
;define the matrix to be solved:
matrix=fltarr(npts, npts)
for i=0, npts-1 do begin
matrix[i, *]=x^i
endfor
;solve the matrix:
ludc, matrix, index
; print, npts
return, lusol(matrix, index, y)
end