LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error in the Harmonic Distortion Analyzer VI?

Solved!
Go to solution

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

0 Kudos
Message 1 of 3
(2,619 Views)
Solution
Accepted by topic author stefan.tschannen

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

Message 2 of 3
(2,592 Views)

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

0 Kudos
Message 3 of 3
(2,543 Views)