Last change
on this file since 226 was
38,
checked in by emillour, 14 years ago
|
Ajout du modè Martien (mon LMDZ.MARS.BETA, du 28/01/2011) dans le rértoire mars, pour pouvoir suivre plus facilement les modifs.
EM
|
File size:
1.1 KB
|
Line | |
---|
1 | c****************************************************** |
---|
2 | SUBROUTINE intrplf(x,y,xd,yd,nd) |
---|
3 | c interpolation, give y = f(x) with array xd,yd known, size nd |
---|
4 | |
---|
5 | c Version with CONSTANT values outside limits |
---|
6 | c********************************************************** |
---|
7 | |
---|
8 | c Variable declaration |
---|
9 | c -------------------- |
---|
10 | c Arguments : |
---|
11 | real x,y |
---|
12 | real xd(nd),yd(nd) |
---|
13 | integer nd |
---|
14 | c internal |
---|
15 | integer i,j |
---|
16 | real y_undefined |
---|
17 | |
---|
18 | c run |
---|
19 | c --- |
---|
20 | y_undefined=1.e20 |
---|
21 | |
---|
22 | y=0. |
---|
23 | if ((x.le.xd(1)).and.(x.le.xd(nd))) then |
---|
24 | if (xd(1).lt.xd(nd)) y = yd(1) ! yd(1) |
---|
25 | if (xd(1).ge.xd(nd)) y = yd(nd) ! yd(1) |
---|
26 | else if ((x.ge.xd(1)).and.(x.ge.xd(nd))) then |
---|
27 | if (xd(1).lt.xd(nd)) y = yd(nd) ! yd(1) |
---|
28 | if (xd(1).ge.xd(nd)) y = yd(1) ! yd(1) |
---|
29 | c y = yd (nd) |
---|
30 | else |
---|
31 | do i=1,nd-1 |
---|
32 | if ( ( (x.ge.xd(i)).and.(x.lt.xd(i+1)) ) |
---|
33 | & .or. ( (x.le.xd(i)).and.(x.gt.xd(i+1)) ) ) then |
---|
34 | y=yd(i)+(x-xd(i))*(yd(i+1)-yd(i))/(xd(i+1)-xd(i)) |
---|
35 | goto 99 |
---|
36 | end if |
---|
37 | end do |
---|
38 | end if |
---|
39 | |
---|
40 | 99 continue |
---|
41 | return |
---|
42 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.