comparison 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
comparison
equal deleted inserted replaced
66:aa125ad6e842 67:0159abc1a9d8
1254 SetCtrlVal(MainPanel, PANEL_MEASURE_SLOPE, 0); 1254 SetCtrlVal(MainPanel, PANEL_MEASURE_SLOPE, 0);
1255 } 1255 }
1256 1256
1257 // update slope measurement 1257 // update slope measurement
1258 Nsamples = Nsamples + 1; 1258 Nsamples = Nsamples + 1;
1259 measuredSlope = (measuredSlope * (Nsamples - 2) + 6 * (currentFreq - meanFreq) / Nsamples) / (Nsamples + 1);
1259 meanFreq = ((Nsamples - 1) * meanFreq + currentFreq) / Nsamples; 1260 meanFreq = ((Nsamples - 1) * meanFreq + currentFreq) / Nsamples;
1260 measuredSlope = (measuredSlope * (Nsamples - 2) + 6 * (currentFreq - meanFreq) / Nsamples) / (Nsamples + 1);
1261 previousFreq = currentFreq; 1261 previousFreq = currentFreq;
1262 // update indicator 1262 // update indicator
1263 SetCtrlVal(MainPanel, PANEL_SLOPE_MEASURED, measuredSlope); 1263 SetCtrlVal(MainPanel, PANEL_SLOPE_MEASURED, measuredSlope);
1264 1264
1265 // update applied slope 1265 // update applied slope