| 2 | 1/1 | 返回列表 |
| 查看: 1477 | 回復: 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 |
木蟲 (正式寫手)
newbie
| 2 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考博] 售瀆SCI文章,我:8⊙ 55 1⊙ 54。備注【⊙=0】 +4 | ipys00zm58 2026-03-05 | 9/450 |
|
|---|---|---|---|---|
|
[考研] 哈爾濱理工大學2026年研究生調(diào)劑,材料科學與化學工程學院研究生調(diào)劑 +3 | xinliu866 2026-03-06 | 3/150 |
|
|
[考研] 324求調(diào)劑 +5 | wxz2 2026-03-03 | 8/400 |
|
|
[考研] 085600材料與化工(高分子)290分求調(diào)劑 +9 | wengyujian 2026-03-04 | 9/450 |
|
|
[考研] 0703 東華大學 理學化學均過 a 線,總分 281 求調(diào)劑 +6 | 香香 Lu 2026-03-03 | 11/550 |
|
|
[考博] 2026申博自薦 六級440電催化方向 +4 | 櫻落成影花成雙 2026-03-05 | 4/200 |
|
|
[考研] 274求調(diào)劑 +9 | 一個學習者 2026-03-04 | 9/450 |
|
|
[考研] 環(huán)境調(diào)劑 +7 | 柒槿levana 2026-03-01 | 7/350 |
|
|
[考研] 264求調(diào)劑 +8 | 26調(diào)劑 2026-03-03 | 8/400 |
|
|
[考研] 一志愿鄭州大學,學碩,物理化學, 333求調(diào)劑 +5 | 李魔女斗篷 2026-03-04 | 5/250 |
|
|
[考研] 材料專碩346求調(diào)劑 +3 | 旺一下 2026-03-04 | 3/150 |
|
|
[考研] 一志愿314求調(diào)劑 +7 | 202111120625 2026-03-03 | 7/350 |
|
|
[考研] 復試調(diào)劑 +4 | 杰尼龜aaa 2026-03-03 | 4/200 |
|
|
[考研] 0703化學306調(diào)劑 +4 | 26要上岸 2026-03-03 | 4/200 |
|
|
[考研]
材料270求調(diào)劑
6+6
|
Eiiiio 2026-03-01 | 11/550 |
|
|
[論文投稿]
通訊作者寫誰,問題是你意想不到的問題
15+3
|
阿爾法啊 2026-03-01 | 3/150 |
|
|
[考研] 288求調(diào)劑 +3 | 少71.8 2026-03-02 | 5/250 |
|
|
[考研] 一志愿東北大學材料專碩328,求調(diào)劑 +3 | shs1083 2026-03-02 | 3/150 |
|
|
[考研] 279求調(diào)劑 +3 | dua1 2026-03-01 | 4/200 |
|
|
[考研] 化工299分求調(diào)劑 一志愿985落榜 +5 | 嘻嘻(*^ω^*) 2026-03-01 | 5/250 |
|