diff options
| author | Christoph Berg <myon@debian.org> | 2021-09-09 22:49:00 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2021-09-09 22:49:00 +0200 |
| commit | 85895feeaf88bcde26bbfc71e8f6b2047c0f5f41 (patch) | |
| tree | 79807e00771e4af4ce279e368262f2222806102f /map65/libm65/iqcal.f90 | |
| parent | 2f095a04ed69d9aa14b47dc4acde6b3225b2d65e (diff) | |
New upstream version 2.5.0~rc6+repackupstream/2.5.0_rc6+repack
Diffstat (limited to 'map65/libm65/iqcal.f90')
| -rw-r--r-- | map65/libm65/iqcal.f90 | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/map65/libm65/iqcal.f90 b/map65/libm65/iqcal.f90 new file mode 100644 index 00000000..c0c4fce2 --- /dev/null +++ b/map65/libm65/iqcal.f90 @@ -0,0 +1,30 @@ +subroutine iqcal(nn,c,nfft,gain,phase,zsum,ipk,reject) + + complex c(0:nfft-1) + complex z,zsum,zave + + if(nn.eq.0) then + zsum=0. + endif + nn=nn+1 + smax=0. + ipk=1 + do i=1,nfft-1 !Find strongest signal + s=real(c(i))**2 + aimag(c(i))**2 + if(s.gt.smax) then + smax=s + ipk=i + endif + enddo + pimage=real(c(nfft-ipk))**2 + aimag(c(nfft-ipk))**2 + p=smax + pimage + z=c(ipk)*c(nfft-ipk)/p !Synchronous detection of image + zsum=zsum+z + zave=zsum/nn + tmp=sqrt(1.0 - (2.0*real(zave))**2) + phase=asin(2.0*aimag(zave)/tmp) !Estimate phase + gain=tmp/(1.0-2.0*real(zave)) !Estimate gain + reject=10.0*log10(pimage/smax) + + return +end subroutine iqcal |
