From 56898ec576c92a267cc47b19f73be919f407c75a Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 11 Jan 2007 21:51:23 +0000 Subject: [PATCH] git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@340 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- fil6521.f | 44 +++++++++++++++++++++++++++++++++++++++++ fil658.f | 50 ++++++++++++++++++++++++++++++++++++++++++++++ fil659.f | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 153 insertions(+) create mode 100644 fil6521.f create mode 100644 fil658.f create mode 100644 fil659.f diff --git a/fil6521.f b/fil6521.f new file mode 100644 index 000000000..e962203eb --- /dev/null +++ b/fil6521.f @@ -0,0 +1,44 @@ + subroutine fil6521(c1,n1,c2,n2) + +C FIR lowpass filter designed using ScopeFIR + +C Pass #1 Pass #2 +C----------------------------------------------- +C fsample (Hz) 1378.125 Input sample rate +C Ntaps 21 Number of filter taps +C fc (Hz) 40 Cutoff frequency +C fstop (Hz) 172.266 Lower limit of stopband +C Ripple (dB) 0.1 Ripple in passband +C Stop Atten (dB) 38 Stopband attenuation +C fout (Hz) 344.531 Output sample rate + + parameter (NTAPS=21) + parameter (NH=NTAPS/2) + parameter (NDOWN=4) !Downsample ratio = 1/4 + complex c1(n1) + complex c2(n1/NDOWN) + +C Filter coefficients: + real a(-NH:NH) + data a/ + + -0.011958606980,-0.013888627387,-0.015601306443,-0.010602249570, + + 0.003804023436, 0.028320058273, 0.060903935217, 0.096841904411, + + 0.129639871228, 0.152644580853, 0.160917511283, 0.152644580853, + + 0.129639871228, 0.096841904411, 0.060903935217, 0.028320058273, + + 0.003804023436,-0.010602249570,-0.015601306443,-0.013888627387, + + -0.011958606980/ + + n2=(n1-NTAPS+NDOWN)/NDOWN + k0=NH-NDOWN+1 + +C Loop over all output samples + do i=1,n2 + c2(i)=0. + k=k0 + NDOWN*i + do j=-NH,NH + c2(i)=c2(i) + c1(j+k)*a(j) + enddo + enddo + + return + end diff --git a/fil658.f b/fil658.f new file mode 100644 index 000000000..04e8cdb49 --- /dev/null +++ b/fil658.f @@ -0,0 +1,50 @@ + subroutine fil658(c1,n1,c2,n2) + +C FIR lowpass filter designed using ScopeFIR + +C Pass #1 Pass #2 Pass #3 +C----------------------------------------------- +C fsample (Hz) 96000.0 24000 6000 Input sample rate +C Ntaps 47 47 47 Number of filter taps +C fc (Hz) 6000 1500 375 Cutoff frequency (-3 dB) +C fstop (Hz) 11025.0 2756.25 689.0625 Lower limit of stopband +C Ripple (dB) 0.06 0.06 0.06 Ripple in passband +C Stop Atten (dB) 41 41 41 Stopband attenuation +C fout (Hz) 24000.0 6000 1500 Output sample rate + + parameter (NTAPS=47) + parameter (NH=NTAPS/2) + parameter (NDOWN=4) !Downsample ratio = 1/4 + complex c1(n1) + complex c2(n1/NDOWN) + +C Filter coefficients: + real a(-NH:NH) + data a/ + + 0.004066057444,-0.000483030239,-0.002085155775,-0.004036668720, + + -0.005338083014,-0.004952374329,-0.002267639582, 0.002499787691, + + 0.008113543743, 0.012522509052, 0.013441779030, 0.009233544068, + + -0.000256999594,-0.013156485907,-0.025660797518,-0.032755808092, + + -0.029602578877,-0.013013352845, 0.017249853203, 0.057885304099, + + 0.102497204557, 0.142897857652, 0.171067807479, 0.181167084990, + + 0.171067807479, 0.142897857652, 0.102497204557, 0.057885304099, + + 0.017249853203,-0.013013352845,-0.029602578877,-0.032755808092, + + -0.025660797518,-0.013156485907,-0.000256999594, 0.009233544068, + + 0.013441779030, 0.012522509052, 0.008113543743, 0.002499787691, + + -0.002267639582,-0.004952374329,-0.005338083014,-0.004036668720, + + -0.002085155775,-0.000483030239, 0.004066057444/ + + n2=(n1-NTAPS+NDOWN)/NDOWN + k0=NH-NDOWN+1 + +C Loop over all output samples + do i=1,n2 + c2(i)=0. + k=k0 + NDOWN*i + do j=-NH,NH + c2(i)=c2(i) + c1(j+k)*a(j) + enddo + enddo + + return + end diff --git a/fil659.f b/fil659.f new file mode 100644 index 000000000..f0f997c46 --- /dev/null +++ b/fil659.f @@ -0,0 +1,59 @@ + subroutine fil659(id,n1,f0,c2a,c2b,n2) + +C FIR lowpass filter designed using ScopeFIR + +C fsample (Hz) 96000.0 Input sample rate +C Ntaps 23 Number of filter taps +C fc (Hz) 1500 Cutoff frequency (-3 dB) +C fstop (Hz) 12000 Lower limit of stopband +C Ripple (dB) 0.05 Ripple in passband +C Stop Atten (dB) 45 Stopband attenuation +C fout (Hz) 24000.0 Output sample rate + + parameter (NTAPS=23) + parameter (NH=NTAPS/2) + parameter (NDOWN=4) !Downsample ratio = 1/4 + integer*2 id(4,n1) + complex c2a(n1/NDOWN),c2b(n1/NDOWN) + complex z + real*8 dt,dpha,twopi + complex w,w0,wstep + data twopi/6.2831853071796/ + +C Filter coefficients: + real a(-NH:NH) + data a/ + + -0.006192694772,-0.009005098228,-0.011852791893,-0.011064464062, + + -0.004044201520, 0.010987986233, 0.034169891384, 0.063459565756, + + 0.094796253511, 0.122845919676, 0.142302928050, 0.149270332282, + + 0.142302928050, 0.122845919676, 0.094796253511, 0.063459565756, + + 0.034169891384, 0.010987986233,-0.004044201520,-0.011064464062, + + -0.011852791893,-0.009005098228,-0.006192694772/ + + + n2=(n1-NTAPS+NDOWN)/NDOWN + k0=NH-NDOWN+1 + +C Loop over all output samples + dt=1.d0/96000.d0 + dpha=twopi*f0*dt + wstep=cmplx(cos(dpha),sin(dpha)) + k=k0+NDOWN + w0=1.0 + do i=1,n2 + c2a(i)=0. + c2b(i)=0. + k=k0 + NDOWN*i + w=w0 + do j=-NH,NH + w=w*wstep + if(j.eq.3-NH) w0=w + z=a(j)*cmplx(float(id(1,j+k)),float(id(2,j+k)))*w + c2a(i)=c2a(i) + z + z=a(j)*cmplx(float(id(3,j+k)),float(id(4,j+k)))*w + c2b(i)=c2b(i) + z + enddo + enddo + + return + end