# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution
Highlighted

## FFT (till harmonic n) of 2D array

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/

Message 1 of 5
(1,416 Views)

## Re: FFT (till harmonic n) of 2D array

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
(1,395 Views)

## Re: FFT (till harmonic n) of 2D array

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

Message 3 of 5
(1,375 Views)

## Re: FFT (till harmonic n) of 2D array

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 ǝɥʇ'

Message 4 of 5
(1,360 Views)
Solution
Accepted by topic author VS_03
08-28-2016 06:17 AM

## Re: FFT (till harmonic n) of 2D array

@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.

LabVIEW Champion Do more with less code and in less time
Message 5 of 5
(1,328 Views)