LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FFT Twiddle Factors

Does anyone know how can we obtain FFT Twiddle Factors in LabVIEW?

0 Kudos
Message 1 of 8
(1,601 Views)
Well, first you would look in the detailed help file to find any information on the exact FFT algorithm LabVIEW employs. Then, of course, research that algorithm to determine what twiddle factors (IF ANY) are necessary for the assumptions the algorithm depends upon.

"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 8
(1,574 Views)

A Web search for FFT Twiddle Factors will show you that your question makes little sense.  The FFT, particularly the Radix-2 FFT known to some as the Cooley-Tukey Algorithm (Jim Cooley, whom I met in my student years, gave me a copy of the IBM Research paper I used to code this algorithm in Fortran using punch cards), exploits interesting symmetries when the number of points being transformed is composed of relatively few prime factors (so the Radix-2 FFT, where the number of points is a power of 2, is the simplest and probably the most common implementation).

 

Fortunately for LabVIEW users, we no longer need to write LabVIEW code to do FFTs (NI has done it for us).  You can ask "Are the Twiddle Factors that LabVIEW is using in its implementation correctly computed?", and you can do a test by generating a Waveform whose harmonic composition you know, taking its FFT, and seeing if LabVIEW gives you back your starting harmonic composition (for fastest and most accurate results, use an N that is a power of 2).

 

Bob Schor

0 Kudos
Message 3 of 8
(1,559 Views)

Twiddle factors are a concept of some FFT algorithms, nothing specific to LabVIEW. They depend on the specific algorithm and the data size, so your question is very fuzzy to begin with.

 

LabVIEW uses highly optimized libraries that work well for all sizes. You need to treat it as a black box and trust it! (see also my comments here). There is a good chance that they use the Intel MKL, but have not investigated that in detail.

 

You are welcome to write your own FFT from basic primitives, including twiddle factors, and see how close you get with the stock algorithms. It's all just math, right? I doubt you'll get even close. 😄

 

A very poor "literal" implementation of FFT can be found here, so start with that. 😄 To speed it up once you know the size and it does not change, you can pre-calculate the lower part of the code and cache it, for example.

 

altenbach_0-1583092263401.png

 

0 Kudos
Message 4 of 8
(1,544 Views)

Google Bard AI has a good explanation:

 

altenbach_0-1679764767400.png

 

0 Kudos
Message 5 of 8
(1,532 Views)

@altenbach wrote:

 

LabVIEW uses highly optimized libraries that work well for all sizes. You need to treat it as a black box and trust it! (see also my comments here). There is a good chance that they use the Intel MKL, but have not investigated that in detail.


This is a very good assumption. Almost all LabVIEW Advanced Analysis library functions are since about LabVIEW 7.1 using the Intel MKL under the hood. Before that, NI used to have its own AAL library written in C code, but they decided that there was no way they could compete with the expertise of Intel engineers in the long run to optimize the library for all possible CPU families.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 6 of 8
(1,513 Views)

@altenbach wrote:

Google Bard AI has a good explanation:

 

altenbach_0-1679764767400.png

 


Sigh.  Google's "Bard", of course, is wrong!  For an order N FFT, the Twiddle factors are basically mulltiples of the N-th roots of 1, so the extra "division by N" in the exponent above should be erased.  I went looking for my (more-than-two-decade-old?) Fortran routine, but couldn't find it.  Oh, well, this algorithm is too well-known (and easily checked) that I, for one, take NI on faith that they "did it right" (and certainly optimized it far better than I would be able to do by trying to write LabVIEW code to do it).

 

Bob Schor

0 Kudos
Message 7 of 8
(1,490 Views)

@linu95k wrote:

Does anyone know how can we obtain FFT Twiddle Factors in LabVIEW?


So re-reading the question,  ...

 

  • do you want to find out what twiddle factors (if any), the LabVIEW FFT uses or
  • do you want to calculate twiddle factors from first principles, giving an explicit FFT algorithm.

 

0 Kudos
Message 8 of 8
(1,467 Views)