From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FFT (till harmonic n) of 2D array

Solved!
Go to solution

Hello comuunity,

I want to record a FFT for specific frequency range. The input is a 2D array in which each row represents a record. I just need magnitude und phase of the harmonic (up to the n - controllable). I do not need too many harmonics, so I would like to avoid calculations and make only up to certain frequency the FFT.

 

I would take this VI, but is there any option to define a range for FFT? Or can another VI get Magn.&Phase for harmonics?

https://zone.ni.com/reference/en-XX/help/371361H-01/lvanls/amp_and_phase_spectrum/

0 Kudos
Message 1 of 5
(5,370 Views)

DFT resolution is defined by the record length

DFT max freq. is defined by the samplerate

 

However I would use the tone detection vi.

run it once  on one record to get the main frequency

for n harmonics run it in a loop (n+1 times)  on both records and define the search range to detect amplitude and phase of the harmonics.  Try the help on tone detection 😉

 

record length should be >10 periodes of main freq.

 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 2 of 5
(5,349 Views)

Thank you for the fast answer.

 

I built a VI for test on performance. I know the main frequency, so no detection is needed. In performance the Amplitude and Phase Spectrum VI is (with 8 harmonics) 7ms (~20%) faster than Extract Multiple Tone Information VI. In addition the extract VI works with wvf and "fail" in detection of frequencies. On the other side the spectrum gives me the rms, so there will be an additional multiplication for amplitude (or is there a better way?)

 

Greetings back from Germany

0 Kudos
Message 3 of 5
(5,329 Views)

Sorry can't open your vi, still use 2012 .... (it's really time for an update 😉 )

What do you mean by "fail" in detection of frequencies ?    OK, if there is no peak at that frequency, it will fail.

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 4 of 5
(5,314 Views)
Solution
Accepted by VS_03

@VS_03 wrote:

...(or is there a better way?)

 

Well, if you exactly know the spectral positions and the data is clean (no spectral leakage, no truncated periods, etc.), all you need to do is the multiplications with the complex unit waves of the desired frequencies. (see also this to get the amplitude for the fundamental frequency, it can easily expanded for more spectral positions.) Be aware that FFT is very efficient, so if you need a significant amount of spectral positions, it might be faster.

Message 5 of 5
(5,282 Views)