Blame view

fvn_test/test_lsp.f90 1.1 KB
27d3b84d6   daniau   git-svn-id: https...
1
  program lsp
2919a9e2d   daniau   git-svn-id: https...
2
  use fvn_linear
27d3b84d6   daniau   git-svn-id: https...
3
4
5
  implicit none
  integer,parameter :: npoints=13,deg=3
   integer :: status,i
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
6
7
   real(kind=dp_kind) :: xm(npoints),ym(npoints),xstep,xc,yc
   real(kind=dp_kind) :: coeff(deg+1)
27d3b84d6   daniau   git-svn-id: https...
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
   xm = (/ -3.8,-2.7,-2.2,-1.9,-1.1,-0.7,0.5,1.7,2.,2.8,3.2,3.8,4. /)
   ym = (/ -3.1,-2.,-0.9,0.8,1.8,0.4,2.1,1.8,3.2,2.8,3.9,5.2,7.5 /)
   open(2,file='fvn_lsp_double_mesure.dat')
   open(3,file='fvn_lsp_double_poly.dat')
   do i=1,npoints
      write(2,44) xm(i),ym(i)
   end do
   close(2)
   call fvn_lspoly(npoints,xm,ym,deg,coeff,status)
   xstep=(xm(npoints)-xm(1))/1000.
   do i=1,1000
      xc=xm(1)+(i-1)*xstep
      yc=poly(xc,coeff)
      write(3,44) xc,yc
   end do
   close(3)
  write(*,*) "All done, plot results with gnuplot using command :"
  write(*,*) "pl 'fvn_lsp_double_mesure.dat' u 1:2 w p,'fvn_lsp_double_poly.dat' u 1:2 w l"
  44      FORMAT(4(1X,1PE22.14))
  contains
  function poly(x,coeff)
8d883e8a1   wdaniau   Integration of ki...
29
      use fvn_common
27d3b84d6   daniau   git-svn-id: https...
30
      implicit none
f6bacaf83   cwaterkeyn   ChW 11/09: ANSI c...
31
32
33
      real(kind=dp_kind) :: x
      real(kind=dp_kind) :: coeff(deg+1)
      real(kind=dp_kind) :: poly
27d3b84d6   daniau   git-svn-id: https...
34
35
36
37
38
39
40
      integer :: i
      poly=0.
      do i=1,deg+1
           poly=poly+coeff(i)*x**(i-1)
      end do
  end function
  end program