| 2 | 1/1 | 返回列表 |
| 查看: 1486 | 回復(fù): 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)劑 +5 | 18880831720 2026-03-11 | 5/250 |
|
|---|---|---|---|---|
|
[考研] 0703化學(xué)一志愿211 總分320求調(diào)劑 +3 | 瑪卡巴卡啊哈 2026-03-11 | 3/150 |
|
|
[考研] 0703求調(diào)劑 +6 | jtyq001 2026-03-10 | 6/300 |
|
|
[考研] 334求調(diào)劑 +3 | mjqzz 2026-03-06 | 3/150 |
|
|
[考研] 一志愿江南大學(xué)085701環(huán)境工程專碩總分287求調(diào)劑 +5 | 18266118446 2026-03-09 | 5/250 |
|
|
[考研] 材料與化工(0856)304求B區(qū)調(diào)劑 +6 | 邱gl 2026-03-10 | 9/450 |
|
|
[考研] 一志愿浙江大學(xué)0856材料與化工求調(diào)劑 +3 | yansheng@211 2026-03-09 | 4/200 |
|
|
[考研] 考研材料與化工,求調(diào)劑 +7 | 戲精丹丹丹 2026-03-09 | 7/350 |
|
|
[考研] 298求調(diào)劑 +3 | Vv呀! 2026-03-10 | 3/150 |
|
|
[考研] 085600 材料與化工 295 求調(diào)劑 +9 | dream…… 2026-03-10 | 9/450 |
|
|
[考研] 0856材料與化工353分求調(diào)劑 +11 | NIFFFfff 2026-03-09 | 11/550 |
|
|
[考研] 0703化學(xué)調(diào)劑 +7 | 小奶蒼 2026-03-07 | 7/350 |
|
|
[考研] 320求調(diào)劑 +4 | 魏zy 2026-03-08 | 4/200 |
|
|
[考研] 0703化學(xué)求調(diào)劑,總分309分,一志愿華南師范 +3 | 花與葉@ 2026-03-08 | 3/150 |
|
|
[考研] 安徽農(nóng)業(yè)大學(xué)材料與化學(xué)學(xué)院0856材料招收調(diào)劑 +3 | akakk47 2026-03-05 | 9/450 |
|
|
[考研] 334求調(diào)劑 +8 | Trying] 2026-03-06 | 8/400 |
|
|
[考研] 322分 085600求調(diào)劑,有互聯(lián)網(wǎng)+國金及主持省級大創(chuàng)經(jīng)歷 +4 | 熊境喆 2026-03-05 | 4/200 |
|
|
[考研] 070300化學(xué)求調(diào)劑292分 +3 | 打烊eee 2026-03-07 | 3/150 |
|
|
[考研] 材料與化工304求B區(qū)調(diào)劑 +4 | 邱gl 2026-03-06 | 4/200 |
|
|
[考研] 271求調(diào)劑 +7 | 月色c 2026-03-05 | 8/400 |
|