07-11-2011 01:25 PM
07-28-2011 01:27 AM
Thanks,
I correct my mistake and use your example and the sine-fitting works. The algorithm works fine (good convergence) but it's long (6 seconds to find the solution). It exist solutions or options to speed up the algorithm (and maybe lost in precision) ?
Regards,
Benjamin
Remarks : just a little mistake in "Test sine-fittingMOD2 Folder.zip". It calculate 1/Fsample instead of Fsample, so the value of frequency found by the FFT analysis doesn't works (but in my sample data, Fsample = 1, so there is no difference ! ).
07-28-2011 02:24 AM
@benj wrote:
I correct my mistake and use your example and the sine-fitting works. The algorithm works fine (good convergence) but it's long (6 seconds to find the solution). It exist solutions or options to speed up the algorithm (and maybe lost in precision) ?
It executes pretty fast on my computer, but you hopefully noticed that the initial estimates from the "detect single tone" would be equally good for all practical purpose. Use those and forget about the nonlinear fitting. It does not add any real value in this case.
07-29-2011 10:09 AM
Hi,
I don't want only an estimation of the frequency but I need to fit my data in order to have information about residual rms error between observation-data and fit-data to calculate ENOB (effective number of bits). So, it'is possible to speed-up the fitting alogritm ?
Regards,
Benjamin
07-29-2011 10:22 AM - edited 07-29-2011 10:23 AM
In my demo I already show how to calculate the function from the outputs of extract single tone (using call by reference node).
Now use this as the best fit and you can calculate your RMS error (and anyting else) by comparing to the raw data.
06-14-2020 01:02 PM
@altenbach wrote:
Try this quick draft. (sorry, I did not triple check for units, etc.)
A bit old post, but anyway, dear @altenbach, thanks for posting this example. On my laptop with i7-6700 and LV2019 the function "Extract Single Tone Information VI" executes for about 2ms for 16k input samples. This is more than 2 orders of magnitude faster than non-linear curve fit (~260ms). For 1.6k data length I get less than 1ms. This is exactly what I need, I will try this on cRIO NI-9035 and hopefully it work for my real-time application.
06-14-2020 02:33 PM - edited 06-14-2020 02:33 PM
Of course extract single tone would be much faster than any iterative fitting procedure, especially if export mode=none (you can look inside to see what it does!). Depending on the needs, a simple FFT followed by R(max), might be sufficient and even faster. 😄
Fitting to a sine function is not the same as extracting a single tone. Giving reasonable initial guesses, fitting will continue to work even if the data consists of only a partial period, so the use case is very different.