| 2 | 1/1 | 返回列表 |
| 查看: 1473 | 回復: 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ā)表 | |
|---|---|---|---|---|
|
[考研] 化學工程求調(diào)劑 +6 | 化工人999 2026-03-04 | 6/300 |
|
|---|---|---|---|---|
|
[考研] 材料與化工,291分,求調(diào)劑 +6 | 咕嚕咕嚕123123 2026-03-04 | 6/300 |
|
|
[考研] 085600材料與化工 298 調(diào)劑 +7 | 小西笑嘻嘻 2026-03-03 | 7/350 |
|
|
[考研] 一志愿中科大080500總分324求調(diào)劑 +3 | jorna 2026-03-03 | 6/300 |
|
|
[考研] 0857求調(diào)劑 +4 | CDDD1013 2026-03-04 | 4/200 |
|
|
[考研] 085601 材料工程 320 +6 | 和樂瑤 2026-03-03 | 6/300 |
|
|
[論文投稿]
100+3
|
Stray2021 2026-03-03 | 3/150 |
|
|
[考研] 347分電子信息專碩求調(diào)劑 +3 | 咕嘟咕嘟1 2026-03-03 | 3/150 |
|
|
[考研] 0703化學調(diào)劑 +4 | G212 2026-03-03 | 5/250 |
|
|
[考研] 求調(diào)劑院校 +6 | 云朵452 2026-03-02 | 11/550 |
|
|
[考研] 0703化學 學碩 理工科均可 不區(qū)分研究方向 總分279求調(diào)劑 +5 | 1一11 2026-03-03 | 5/250 |
|
|
[考研] 306求調(diào)劑 +7 | 張張張張oo 2026-03-03 | 7/350 |
|
|
[考研] 化工270求調(diào)劑 +10 | 什么名字qwq 2026-03-02 | 10/500 |
|
|
[考研] 化學0703求調(diào)劑 學碩 理/工科均可 總分279 +3 | 1一11 2026-03-03 | 5/250 |
|
|
[考研] 【2026 碩士調(diào)劑】課題組 招收調(diào)劑生 +3 | 考研版棒棒 2026-03-02 | 5/250 |
|
|
[考研] 化學,材料,環(huán)境類求調(diào)劑 +7 | 考研版棒棒 2026-03-02 | 7/350 |
|
|
[考研] 281求調(diào)劑 +5 | 2026計算機_誠心 2026-03-01 | 8/400 |
|
|
[考研] 264求調(diào)劑 +4 | 巴拉巴拉根556 2026-02-28 | 4/200 |
|
|
[碩博家園] 博士自薦 +7 | 科研狗111 2026-02-26 | 11/550 |
|
|
[考研] 304求調(diào)劑 +3 | 52hz~~ 2026-02-28 | 5/250 |
|