| ²é¿´: 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 |
» ²ÂÄãϲ»¶
281Çóµ÷¼Á£¨0805£©
ÒѾÓÐ8È˻ظ´
»·¾³ÁìÓòÈ«¹úÖØµãʵÑéÊÒÕÐÊÕ²©Ê¿1-2Ãû
ÒѾÓÐ3È˻ظ´
²ÄÁÏר˶306Ó¢Ò»Êý¶þ
ÒѾÓÐ10È˻ظ´
301Çóµ÷¼Á
ÒѾÓÐ6È˻ظ´
Ò»Ö¾Ô¸Ìì½ò´óѧ»¯Ñ§¹¤ÒÕרҵ£¨081702£©315·ÖÇóµ÷¼Á
ÒѾÓÐ7È˻ظ´
302Çóµ÷¼Á
ÒѾÓÐ6È˻ظ´
26²©Ê¿ÉêÇë
ÒѾÓÐ3È˻ظ´
268Çóµ÷¼Á
ÒѾÓÐ3È˻ظ´
311Çóµ÷¼Á
ÒѾÓÐ10È˻ظ´
±»ÎÒÑÔÖУºÐÂÄ£°å²»Ç¿µ÷¸ñʽÁË£¬¼Ùר¼Ò¿ªÊ¼¹Ü¸ñʽÁË
ÒѾÓÐ4È˻ظ´
wangyikeco
ľ³æ (ÕýʽдÊÖ)
newbie
- Ó¦Öú: 84 (³õÖÐÉú)
- ½ð±Ò: 7063
- Ìû×Ó: 545
- ÔÚÏß: 111.9Сʱ
- ³æºÅ: 25598800
- ×¢²á: 2021-03-03
- ÐÔ±ð: GG
- רҵ: Äý¾Û̬ÎïÐÔ II £ºµç×ӽṹ
2Â¥2025-05-07 00:47:03













»Ø¸´´ËÂ¥