Hi Ryan,
Many thanks for pointing out the error in calculating the value of
Doppler Spread for FST4 decodes! You are (almost) 100% correct, and the
bug will be fixed in the next release of WSJT-X. In Fortran subroutine
lib/fst4_decode.f90 the line
xi1=i - 1 + (sum2-0.25*sum1)/(sum2-sum2z)
will be replaced by
xi1=i - 1 + (0.25*sum1-sum2)/(sum2-sum2z)
I say 'almost' only because there was a stray right-parenthesis after
'sum1' in your rendering of the corrected line of code.
Thanks again for catching this error!
-- 73, Joe, K1JT
On 11/21/2023 12:53 PM, Tolboom, Ryan via wsjt-devel wrote:
Good Evening,
I'm looking at lib/fst4_decode.f90, specifically the code where it
calculates the frequency in the channel gain function, /g/, at which it
reaches a certain percentage of the signal power. This can be found on
line 999 of lib/fst4_decode.f90
<https://sourceforge.net/p/wsjt/wsjtx/ci/master/tree/lib/fst4_decode.f90#l999>.
To prevent zero Doppler Spreads it uses a linear interpolation to get a
floating point "index" between bins of the FFT. It does this by setting
xi1 (and xi2, xi3 in a similar fashion) to the current index minus one
plus the difference between the current power (sum2) and the power we're
looking for (sum2 * 0.25, for xi1) divided by the difference between the
current power (sum2) and the previous power (sum2z):
xi1=i-1+(sum2-0.25*sum1)/(sum2-sum2z)
If I'm interpreting this correctly this will not yield a correct result.
Let me give you an example:
For simplicity, assume we have four bins with powers 1, 2, 9, 2, and 1
respectively. Assume the bins are enumerated from zero.
image.png
The total power would be 15 and 25% of that would be 3.75. As we look
for that 25% mark, we'd find it in the do loop when i hits 2, sum2 is
12, and sum2z is 3. xi1 would then be set to:
xi1 = 2 - 1 + (12 - 3.75)/(12 - 3) = 1 + 8.25/9 = 1.92
In other words, 92% of the way to bin 1 from bin 2. Shouldn't this be
the other way around? Shouldn't it be 92% of the way working backwards
from bin 2 to bin 1 or 8% of the way from bin 1 to bin 2? It seems like
3.25 is only slightly larger than 3 and significantly less than 12.
i believe the overshoot correction should be the difference between the
power we're looking for and the previous power divided by the difference
between the current power and the previous power:
xi1 = i - 1 + (0.25 * sum1) - sum2z)/(sum2 - sum2z)
Which in this case would yield:
xi1 = 2 - 1 + (3.75 - 3)/(12 - 3) = 1 + 0.75/9 = 1.08
Please let me know if I'm missing something and thanks for your time,
-Ryan Tolboom N2BP
_______________________________________________
wsjt-devel mailing list
wsjt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wsjt-devel
_______________________________________________
wsjt-devel mailing list
wsjt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wsjt-devel