Fortran: Anhang B: Kettenlinie: Catdisl.f90

Aus Wikibooks
module catdisl
  use dislin
  use catmod1

  contains
    subroutine plot(format)
      integer, parameter    :: NR = 100
      real, dimension(0:NR) :: x, y
      integer               :: i
      character(*)          :: format  

      do  i = 0, NR
        x(i) = i*(x2-x1)/NR + x1
        y(i) = a * cosh(x(i)/a)
      end do

      call setpag ("DA4L")   
      call metafl (format)
      call disini 

      call pagfll (255)
      call color ("BLACK")
						
      call graf (x(0), x(NR), x(0), abs(x(0)-x(NR))/3.0, &
                 0.0, maxval(y), 0.0, maxval(y)/3.0)
     
      call color ("RED")
      call linwid (3) 	
      call curve (x, y, NR+1)
     
      x(1) = x(NR)
      y(1) = y(NR) 	
      call color ("BLUE")
      call linwid (1)
      call chndot
      call curve (x, y, 2)
    
      call disfin 
    end subroutine plot
end module catdisl