Znn3bq.jpeg
±±¾©Ê¯ÓÍ»¯¹¤Ñ§Ôº2026ÄêÑо¿ÉúÕÐÉú½ÓÊÕµ÷¼Á¹«¸æ
²é¿´: 1520  |  »Ø¸´: 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 µÄÖ÷Ìâ¸üÐÂ
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] Ò»Ö¾Ô¸¼ª´ó»¯Ñ§327Çóµ÷¼Á +10 ÍõÍõ°×ʯ 2026-04-06 11/550 2026-04-07 23:54 by JourneyLucky
[¿¼ÑÐ] ÉúÎïѧ308·ÖÇóµ÷¼Á£¨Ò»Ö¾Ô¸»ª¶«Ê¦´ó£© +12 ÏàÐűػá¹ââÍòÕ 2026-04-06 15/750 2026-04-07 21:22 by ÇÇßÕßÕßÕ
[¿¼ÑÐ] »¯Ñ§µ÷¼Á +18 °¬Ö¾ºã 2026-04-03 19/950 2026-04-07 16:00 by Æð·ÉµÄ±ÈÐÜ1
[¿¼ÑÐ] 26×ÔÈ»µØÀíѧ303·ÖÇóµ÷¼Á +4 Ò»Õ½³É˶°¡°¡°¡° 2026-04-06 9/450 2026-04-06 20:35 by lin-da
[¿¼ÑÐ] 308Çóµ÷¼Á +3 ÖÕ²»ËÆ´Óǰ 2026-04-05 3/150 2026-04-05 22:23 by hemengdong
[¿¼ÑÐ] ²ÄÁÏר˶322·Ö +10 ¹þ¹þ¹þºðºðºð¹þ 2026-04-04 10/500 2026-04-05 21:22 by ѧԱ8dgXkO
[¿¼ÑÐ] 283Çóµ÷¼Á +5 baiiyu 2026-04-05 6/300 2026-04-05 20:35 by à£à£à£0119
[¿¼ÑÐ] Çóµ÷¼Á +10 Hllºú 2026-04-04 10/500 2026-04-05 20:09 by nepu_uu
[¿¼ÑÐ] µç×ÓÐÅÏ¢µ÷¼Á½»²æÑ§¿ÆÓÐÍÆ¼öÂð +6 jhtfeybgj 2026-04-01 9/450 2026-04-05 11:13 by Öí»á·É
[¿¼²©] É격 +7 IQwQl 2026-04-04 7/350 2026-04-04 23:32 by mumin1990
[¿¼ÑÐ] 295Çóµ÷¼Á +4 AÄãºÃÑо¿Éú 2026-04-04 5/250 2026-04-04 22:46 by yu221
[¿¼ÑÐ] Çóµ÷¼Á»ú»á +5 ÒâȾivy 2026-04-03 5/250 2026-04-03 15:13 by qoooooo614
[¿¼ÑÐ] Çóµ÷¼Á +4 15064154688 2026-04-03 5/250 2026-04-03 15:07 by zrongyan
[¿¼ÑÐ] 283Çóµ÷¼Á +3 jiouuu 2026-04-03 4/200 2026-04-03 13:28 by jiouuu
[¿¼ÑÐ] 330Çóµ÷¼Á +3 °×ÉñÎØºôºô 2026-04-02 3/150 2026-04-03 10:15 by À¶ÔÆË¼Óê
[¿¼ÑÐ] ר˶ 351 086100 Ò²ÊÇ¿¼µÄ²Ä¿Æ»ù ±¾¿ÆÒ²ÊDzÄÁÏ +8 202451007219 2026-04-02 8/400 2026-04-03 09:50 by À¶ÔÆË¼Óê
[¿¼ÑÐ] Ò»Ö¾Ô¸±±¾©¿Æ¼¼²ÄÁÏ¿ÆÑ§Ó빤³Ì288·Ö£¬Çóµ÷¼Á +14 Êdz½°¡ 2026-04-02 14/700 2026-04-02 21:10 by dongzh2009
[¿¼ÑÐ] Çóµ÷¼Á 302·Ö³õÊÔ 0854 +5 Áæ¿ÉÀÖ 2026-04-02 5/250 2026-04-02 17:53 by ±ÊÂä½õÖÝ
[¿¼ÑÐ] ʳƷѧ˶362Çóµ÷¼Á +3 xuanxianxian 2026-04-01 3/150 2026-04-01 21:05 by °¡Àî999
[¿¼ÑÐ] 349Çóµ÷¼Á +6 ³ÔµÄ²»ÉÙ 2026-04-01 6/300 2026-04-01 17:55 by JYD2011
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û