diff FXAnalyse.c @ 67:0159abc1a9d8

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.
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Mon, 29 Oct 2012 14:48:08 +0100
parents aa125ad6e842
children 94cb4b29bb47
line wrap: on
line diff
--- 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);