linint3.f
c<html>
c<body>
c<pre>
subroutine linint(x,y)
c
c Given a value of x return a value of y based on interpolation
c within a table of y values (ytab) corresponding to the x values
c contained in the array xtab. The subroutine assumes that the
c values in xtab increase monotonically. Efficiency is increased
c by remembering the table points used in the last call (ilast).
c
c John Mahaffy 2/12/95
c
real xtab(11),ytab(11)
c<a name="save"><font color="FF0000">
save ilast
c</font></a>
data ytab/1.0,2.1,3.2,4.4,5.7,7.1,8.6,10.2,11.9,13.7,15.8/
data xtab
& /300.,400.,500.,600.,700.,800.,900.,1000.,1100.,1200.,1300./
data ilast/1/
if (x.le.xtab(ilast+1)) then
do 20 i1=ilast,1,-1
if(x.ge.xtab(i1)) go to 60
20 continue
write(6,*) 'x = ', x, ' is below the table range'
stop
else
do 40 i1=ilast+1,10
if(x.le.xtab(i1+1)) go to 60
40 continue
write(6,*) 'x = ', x, ' is below the table range'
stop
endif
60 wx=(x-xtab(i1))/(xtab(i1+1)-xtab(i1))
y=(1-wx)*ytab(i1)+wx*ytab(i1+1)
ilast=i1
return
end
c</pre>
c</body>
c</html>