05-29-2015 08:48 AM
Hello
Today I tried to use the harmonics distortion analyzer VI and it seems that there is an error in the VI (or I misunderstood something...).
The phenomenon I observed can very well be shown in the attached example.
Description:
- THD - calc: output for the THD calculated by hand with the amplitudes (in this example: THD = sqrt(2^2+3^2)/4 = 0.901)
- THD - VI: output calculated by the Harmonic Distortion Analyzer VI
Both results are identical if the number of analyzed periods is >= 3 (# periods = # samples*fundamental frequency / Fs). If only 1 or 2 periods are analyzed, the Harmonic Distortion Analyzer VI gives a wrong result.
What is the mistake? Did I do any wrong settings or is it a problem with the VI?
Thanks in advance for the help.
Best regards,
Stefan
Solved! Go to Solution.
05-29-2015 03:00 PM
If you open the block diagram of the Harmonic Distortion Analyzer VI, you will see that it uses Fourier transform techniques to calculate THD. FFTs do not work well with small numbers of cycles and can have large errors when fractional cycles are involved.
In the VI you posted increasing the number of samples to 300 produces identical results to 5 significant figures. At 200 samples the error is about 10%.
When working with FFT based analysis tools, use lots of cycles.
Lynn
06-01-2015 04:47 AM
Hi Lynn
I thought that there may be some other problem because I only observed the error for less than 3 periods...
However I changed the application accordingly and get very good results now.
Thanks a lot.
BR,
Stefan