ccc-----------------------------------------------/fpintrp ccc linear interpolation ccc real function fpintrp(x,fa,xa,n) c c returns fpintrp= f(x) c fa(i) = f(xa(i)) set of n known values of x and f(x). c xa is assumed to be ordered from smallest to largest c c if the xa array is equally spaced, then the faster finteq1d routine c can be used. Note that this routine does zero extrapolation beyond c the endpoints of xa, while finteq1d does do extrapolation... c real fa(n),xa(n) 20 j=lkupr(x,xa,n)+1 if(j .eq. 1) then fpintrp=fa(1) !default for xxa(n) return endif 50 fpintrp=( fa(j-1)*(xa(j)-x) + fa(j)*(x-xa(j-1)) ) 1 / (xa(j)-xa(j-1)) return end