Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/12/06 18:20
Read: times


 
#127825 - You're getting into theory
Responding to: ???'s previous message
Hi Prahlad,

..., But How does FFT algoritham know what exactly is fundamental.


It doesn't. Generally speaking the fundamental frequency of a chosen waveform is the lowest frequency component of the wave. But these are generally special shaped waves like sine waves, square waves, sawtooth and ramp waves. In the most general case of an arbitrary waveform there may be no component frequency that readilly presents itself as fundamental.

So even if a fundamental frequency is evident, there's absolutely nothing special about it as far as the Fourier Transform is concerned. Nonetheless, in your specific case the fundamental frequency will have the greatest amplitude (unless your transformer or whatever it is that's producing the wave has gone completely out to lunch) and should be the lowest frequency (unless you've got some serious aliasing going on).

... according to the commenting in his code.
amplitude[0] = DC
amplitude[1] = Fundamental
amplitude[2] = 2N freq. and so on

But according to some other texts I found on net.
amplitude[1] = 1Hz
amplitude[2] = 2Hz and so on.

Now the confusion is which one of the above two is correct ....


Neither of them is correct, in the strictest sense. A complete Fourier Transform should produce a set of amplitudes as a function of frequency, either discreet or continuous, which extends over the domain of -inf to +inf, and which is symmetrical about 0. But there are many ways to implement the transform, and the output of any given algorithm is pretty much up to the writer of the algorithm.

Many algorithms, for example, simply discard the negative frequencies (as apparently do both of the two you're considering). You will need to make certain that this won't adversely affect your THD calculation. (I'm not being cagey, I really don't know for sure if it will or not, but you might need to double your result).

Some algorithms neglect any dc bias of the time domain signal, as does the second of the two you're considering. As a result, it is also going to neglect any frequency components below 1 Hz (or whatever lower cutoff your particular algorithm employs).

I really want to stress that you need to look up an article or two on the Fourier Transform and at least become familiar with the theory before you place too much trust in some code that you cut and paste into your application. Then look up an article or two on the Fast Fourier Transform. You don't need to become a math major, but you really should be somewhat familiar with these algorithms before you blindly use them.


List of 32 messages in thread
TopicAuthorDate
Measuring THD [ Total Harmonic distortion ]            01/01/70 00:00      
   ANalogue method.            01/01/70 00:00      
      Re: Analogue method.            01/01/70 00:00      
         fundamental flaw?            01/01/70 00:00      
            Re: Fundamental Flaw.            01/01/70 00:00      
               Digital filter            01/01/70 00:00      
                  Re: Fundamental Frequency.            01/01/70 00:00      
               FFT            01/01/70 00:00      
                  mains frequency            01/01/70 00:00      
                     Why rely on an assumption?            01/01/70 00:00      
                  Re: FFT            01/01/70 00:00      
                     FFT            01/01/70 00:00      
         What use?            01/01/70 00:00      
   Goertzel filters, maybe ?            01/01/70 00:00      
   FFT is the first choice            01/01/70 00:00      
      Is it?            01/01/70 00:00      
         If you know the fundamental.            01/01/70 00:00      
            Re: Fundamental            01/01/70 00:00      
               Multiple cycles            01/01/70 00:00      
                  The 50Hz fundamental must dominate            01/01/70 00:00      
               Fundamental and harmonics!            01/01/70 00:00      
                  Re: Fundamental and harmonics.            01/01/70 00:00      
                     You're getting into theory            01/01/70 00:00      
                     That is very simple!            01/01/70 00:00      
         I think, yes            01/01/70 00:00      
   Alfredos Code Doesnt seem to work properly.            01/01/70 00:00      
      Do you want it to write in "C"?            01/01/70 00:00      
         Yes Kai,            01/01/70 00:00      
      Eh? Endian issue.            01/01/70 00:00      
         Tags            01/01/70 00:00      
   How about this method for THD.            01/01/70 00:00      
      Mix of numerical calculation and FFT            01/01/70 00:00      

Back to Subject List