P68.F90

Gauss function


!
! =====> Program - P68.F90
!
!
      PRINT *, 'This is Program >> P68  - GAUSS Function'
!
!     Example of using a function
!     on the RHS of an assignment statement
!
      X = 0.0
L1:   DO J =1,11  ! 11 steps in the positive X direction
         Y=5.0*GAUSS(X,0.0,1.0)+2.5
!
!     The Gaussian or Normal curve has
!     been scaled and translated
!
         PRINT *,X,Y
         X = X + 0.5     ! Increase X by a step of .5
      END DO L1
      STOP
      END
!
!     Example of writing a function
!
      FUNCTION GAUSS(X,U,SD)
      C=1.0/(SD*SQRT(2.0*3.14159))
      GAUSS=C*EXP(-(X-U)**2/(2.0*SD**2))
      RETURN
      END

OUTPUT:
Program entered
 This is Program >> P68  - GAUSS Function
   0.0000000E+00   4.4947124
   0.5000000   4.2603273
   1.0000000   3.7098541
   1.5000000   3.1475883
   2.0000000   2.7699549
   2.5000000   2.5876415
   3.0000000   2.5221593
   3.5000000   2.5043633
   4.0000000   2.5006692
   4.5000000   2.5000799
   5.0000000   2.5000074
Fortran-90 STOP

Come back to the previous page

Page builder: Charles Boivin

Last modified: 11/07/95