diff options
| author | Christoph Berg <myon@debian.org> | 2025-09-15 23:04:23 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2025-09-15 23:04:23 +0200 |
| commit | 0a13f1fdb9928b6d012569dd65f7f6ef18fac2f8 (patch) | |
| tree | d702795f99ac38e0cc17e25f0f7e50fa3e05baf9 /lib/fspread_lorentz.f90 | |
| parent | 310d05acf2c9233f7e336ae7dd9ffb7b54ca4e62 (diff) | |
New upstream version 3.0.0~rc1+repackupstream/3.0.0_rc1+repack
Diffstat (limited to 'lib/fspread_lorentz.f90')
| -rwxr-xr-x | lib/fspread_lorentz.f90 | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/lib/fspread_lorentz.f90 b/lib/fspread_lorentz.f90 index 697d308c..e0493932 100755 --- a/lib/fspread_lorentz.f90 +++ b/lib/fspread_lorentz.f90 @@ -1,47 +1,47 @@ -subroutine fspread_lorentz(cdat,fspread) - - parameter (NZ=3*12000) - complex cdat(0:NZ-1) - complex cspread(0:NZ-1) - complex z - - twopi=8.0*atan(1.0) - nfft=NZ - nh=nfft/2 - df=12000.0/nfft - cspread(0)=1.0 - cspread(nh)=0. - b=6.0 !Use truncated Lorenzian shape for fspread - do i=1,nh - f=i*df - x=b*f/fspread - z=0. - a=0. - if(x.lt.3.0) then !Cutoff beyond x=3 - a=sqrt(1.111/(1.0+x*x)-0.1) !Lorentzian amplitude - phi1=twopi*rran() !Random phase - z=a*cmplx(cos(phi1),sin(phi1)) - endif - cspread(i)=z - z=0. - if(x.lt.3.0) then !Same thing for negative freqs - phi2=twopi*rran() - z=a*cmplx(cos(phi2),sin(phi2)) - endif - cspread(nfft-i)=z - enddo - - call four2a(cspread,nfft,1,1,1) !Transform to time domain - - sum=0. - do i=0,nfft-1 - p=real(cspread(i))**2 + aimag(cspread(i))**2 - sum=sum+p - enddo - avep=sum/nfft - fac=sqrt(1.0/avep) - cspread=fac*cspread !Normalize to constant avg power - cdat=cspread*cdat !Apply Rayleigh fading - - return -end subroutine fspread_lorentz +subroutine fspread_lorentz(cdat,fspread)
+
+ parameter (NZ=3*12000)
+ complex cdat(0:NZ-1)
+ complex cspread(0:NZ-1)
+ complex z
+
+ twopi=8.0*atan(1.0)
+ nfft=NZ
+ nh=nfft/2
+ df=12000.0/nfft
+ cspread(0)=1.0
+ cspread(nh)=0.
+ b=6.0 !Use truncated Lorenzian shape for fspread
+ do i=1,nh
+ f=i*df
+ x=b*f/fspread
+ z=0.
+ a=0.
+ if(x.lt.3.0) then !Cutoff beyond x=3
+ a=sqrt(1.111/(1.0+x*x)-0.1) !Lorentzian amplitude
+ phi1=twopi*rran() !Random phase
+ z=a*cmplx(cos(phi1),sin(phi1))
+ endif
+ cspread(i)=z
+ z=0.
+ if(x.lt.3.0) then !Same thing for negative freqs
+ phi2=twopi*rran()
+ z=a*cmplx(cos(phi2),sin(phi2))
+ endif
+ cspread(nfft-i)=z
+ enddo
+
+ call four2a(cspread,nfft,1,1,1) !Transform to time domain
+
+ sum=0.
+ do i=0,nfft-1
+ p=real(cspread(i))**2 + aimag(cspread(i))**2
+ sum=sum+p
+ enddo
+ avep=sum/nfft
+ fac=sqrt(1.0/avep)
+ cspread=fac*cspread !Normalize to constant avg power
+ cdat=cspread*cdat !Apply Rayleigh fading
+
+ return
+end subroutine fspread_lorentz
|
