²é¿´: 1497  |  »Ø¸´: 1

rlafite

ľ³æ (ÕýʽдÊÖ)

[½»Á÷] Âö³åÐźŵĸß˹չ¿í³ÌÐò ÒÑÓÐ1È˲ÎÓë

!---------------------------
program gaussianbroadening
!------------------------------------------------------------------------------------------------------------
! purpose: perform a gaussian broadening on a set of impulse signal data as input.
! usage:  ./command input_file sigma
!------------------------------------------------------------------------------------------------------------
!
implicit none

integer, parameter     :: dp = kind(1.0d0)
character(len=20)      :: arg, input, output
character(len=100)     :: temp
real(dp), allocatable  :: x0( : ), y0( : )  ! 0 - input, no 0 - output
integer,parameter      :: inputfile = 10, outputfile = 20
real(dp) ::  x, y, xmin, xmax, ysum, yavg, sigma, step, pi  ! sigma2 is sigmasquare
integer  :: i, j, nline, stat  ! nline: number of lines
logical  :: alive

call getarg(1, arg)
input = trim(arg)

inquire(file=input, exist=alive)
if( .not. alive) then
   write(*,*) input, "input_file does not exist! "
   write(*,*) input, "usage:  ./command input_file sigma"
   stop
end if

call getarg(2, arg)
read(arg, *) sigma
step = sigma/20

! open and count number of lines in input file
open( unit=inputfile, file=input, access="sequential", status="old" )

nline = 0
do
     read(unit=inputfile, fmt=*, end=100) temp
     nline = nline + 1
end do
100 continue

rewind(inputfile)

! allocate memory for arrays x0, y0
allocate(x0(1:nline), y0(1:nline))

! read in data from input file
do i = 1, nline
     read( unit=inputfile,fmt=*,iostat=stat ) x0( i ), y0( i )
end do

xmin = x0(1)
xmax = x0(nline)

open( unit=outputfile,file='gb.dat', status='replace',  action='write' )
write(outputfile,*) "./command input_file step sigma"
write(outputfile,*) " inputfile= ", input
write(outputfile,*) " step= ", step
write(outputfile,*) " sigma= ",sigma

pi = 2.0 * acos(0.0_dp)

xmin = xmin - 5.0*sigma
xmax = xmax + 5.0*sigma

x = xmin
do while(x .le. xmax)
     y = 0.0
     do i = 1, nline
       if( abs(x - x0(i)) .le. 3 * sigma ) then
         y = y + y0(i)/(sigma*sqrt(2*pi)) * exp(-1.0*(x - x0(i))**2.0 &
             /(2.0*sigma*sigma) )
       end if
     end do
    write( outputfile,fmt="(f9.2,1x,f15.8)" )  x,  y
    write( *,fmt="(f9.2,1x,f15.8)" ) x, y
     x = x + step
end do

! release memory
deallocate( x0, y0 )

stop
end program gaussianbroadening
»Ø¸´´ËÂ¥

» ²ÂÄãϲ»¶

ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

wangyikeco

ľ³æ (ÕýʽдÊÖ)

newbie

ÓÐÓ㡵ãÔÞ£¡
2Â¥2025-05-07 00:47:03
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
Ïà¹Ø°æ¿éÌø×ª ÎÒÒª¶©ÔÄÂ¥Ö÷ rlafite µÄÖ÷Ìâ¸üÐÂ
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] ²ÄÁÏÓ뻯¹¤Çóµ÷¼Á +6 Ϊѧ666 2026-03-16 6/300 2026-03-17 20:15 by peike
[¿¼ÑÐ] 0854¿É¿çµ÷¼Á£¬Ò»×÷Ò»ÏîºËÐÄÂÛÎÄÎåÏîרÀû£¬Ê¡¡¢¹ú¼¶Ö¤Êé40+ÊýÒ»Ó¢Ò»287 +3 СÀî0854 2026-03-16 3/150 2026-03-17 13:40 by ÈÈÇéɳĮ
[¿¼²©] 26É격 +4 °ËÑ®ËÙÀÀ 2026-03-16 4/200 2026-03-17 13:00 by ÇáËɲ»ÉÙËæ
[ÂÛÎÄͶ¸å] ÓÐûÓдóÀз¢Ð¡ÂÛÎÄÄÜ´øÎÒ¸ö¶þ×÷ +3 ÔöÈñ©ÈË 2026-03-17 4/200 2026-03-17 09:26 by xs74101122
[»ù½ðÉêÇë] ¹ú×Ô¿ÆÃæÉÏ»ù½ð×ÖÌå +6 iwuli 2026-03-12 7/350 2026-03-16 21:18 by sculhf
[¿¼ÑÐ] 333Çóµ÷¼Á +3 ÎÄ˼¿Í 2026-03-16 7/350 2026-03-16 18:21 by ÎÄ˼¿Í
[¿¼ÑÐ] »¯Ñ§µ÷¼Á0703 +8 °¡ÎÒÎÒµÄ 2026-03-11 8/400 2026-03-16 17:23 by ÎҵĴ¬Îҵĺ£
[¿¼ÑÐ] Ò»Ö¾Ô¸211 0703·½Ïò310·ÖÇóµ÷¼Á +3 ŬÁ¦·Ü¶·112 2026-03-15 3/150 2026-03-16 16:44 by houyaoxu
[¿¼ÑÐ] 0703 ÎïÀí»¯Ñ§µ÷¼Á +3 ÎÒ¿ÉÒÔÉϰ¶µÄ¶Ô 2026-03-13 5/250 2026-03-16 10:50 by ÎÒ¿ÉÒÔÉϰ¶µÄ¶ÔÂ
[¿¼ÑÐ] 0856Çóµ÷¼Á +3 ÁõÃÎ΢ 2026-03-15 3/150 2026-03-16 10:00 by houyaoxu
[¿¼ÑÐ] ²ÄÁÏÓ뻯¹¤ 323 Ó¢Ò»+Êý¶þ+Îﻯ£¬Ò»Ö¾Ô¸£º¹þ¹¤´ó ±¾È˱¾¿ÆË«Ò»Á÷ +4 ×ÔÓɵÄ_·ÉÏè 2026-03-13 5/250 2026-03-14 19:39 by hmn_wj
[¿¼ÑÐ] 0703»¯Ñ§Ò»Ö¾Ô¸211 ×Ü·Ö320Çóµ÷¼Á +5 Â꿨°Í¿¨°¡¹þ 2026-03-11 5/250 2026-03-13 21:40 by JourneyLucky
[¿¼ÑÐ] 329Çóµ÷¼Á +3 miaodesi 2026-03-12 4/200 2026-03-13 20:53 by 18595523086
[¿¼ÑÐ] ²ÄÁϹ¤³Ìµ÷¼Á +4 ßäßä¿Õ¿Õ 2026-03-11 4/200 2026-03-13 19:57 by JourneyLucky
[¿¼ÑÐ] Çóµ÷¼Á +7 18880831720 2026-03-11 7/350 2026-03-13 16:10 by JourneyLucky
[¿¼ÑÐ] ²ÄÁÏר˶350 Çóµ÷¼Á +4 Íõ½ð¿Æ 2026-03-12 4/200 2026-03-13 16:02 by ruiyingmiao
[¿¼ÑÐ] Ò»Ö¾Ô¸211»¯Ñ§Ñ§Ë¶310·ÖÇóµ÷¼Á +8 ŬÁ¦·Ü¶·112 2026-03-12 9/450 2026-03-13 15:41 by JourneyLucky
[¿¼ÑÐ] Çóµ÷¼Á +3 ³ÌÓ꺼 2026-03-12 3/150 2026-03-13 15:06 by JourneyLucky
[¿¼ÑÐ] 328»¯¹¤×¨Ë¶Çóµ÷¼Á +4 ¡££¬¡££¬¡££¬¡£i 2026-03-12 4/200 2026-03-13 14:44 by JourneyLucky
[¿¼ÑÐ] һ־Ըɽ´ó07»¯Ñ§ 332·Ö ËÄÁù¼¶Òѹý ±¾¿ÆÉ½¶«Ë«·Ç Çóµ÷¼Á£¡ +3 ²»ÏëÀíÄã 2026-03-12 3/150 2026-03-13 14:18 by JourneyLucky
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û