linint2.f
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
c
c John Mahaffy 2/12/95
c
real xtab(11),ytab(11)
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./
if (x.lt.xtab(1).or.x.gt.xtab(11)) then
write(6,*) 'x = ', x, ' is out of table range'
stop
endif
do 100 i=2,11
if (x.le.xtab(i)) go to 200
100 continue
200 i1=i-1
wx=(x-xtab(i1))/(xtab(i1+1)-xtab(i1))
y=(1-wx)*ytab(i1)+wx*ytab(i1+1)
return
end