# HG changeset patch # User Daniele Nicolodi # Date 1351518488 -3600 # Node ID 0159abc1a9d8e65b81d4ab7eb84911b3028e0912 # Parent aa125ad6e84299d0947781d7791a78d68c87779c Fix slope measurement For the update algorithm to work correclty the slope measurement must be updated before the mean measurement. Other code is affected by the same issue. diff -r aa125ad6e842 -r 0159abc1a9d8 FXAnalyse.c --- a/FXAnalyse.c Mon Oct 29 14:48:01 2012 +0100 +++ b/FXAnalyse.c Mon Oct 29 14:48:08 2012 +0100 @@ -1256,8 +1256,8 @@ // update slope measurement Nsamples = Nsamples + 1; + measuredSlope = (measuredSlope * (Nsamples - 2) + 6 * (currentFreq - meanFreq) / Nsamples) / (Nsamples + 1); meanFreq = ((Nsamples - 1) * meanFreq + currentFreq) / Nsamples; - measuredSlope = (measuredSlope * (Nsamples - 2) + 6 * (currentFreq - meanFreq) / Nsamples) / (Nsamples + 1); previousFreq = currentFreq; // update indicator SetCtrlVal(MainPanel, PANEL_SLOPE_MEASURED, measuredSlope);