Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

detecting appearence of certain FFT frequency

Solved!
Go to solution

Hi,

 

I'm using the PCI-5122 and NI-Scope functions to acquire a signal.

I use a bandpass IIR filter on this signal.

I then use the Express -> Spectral Analysis VI to plot an FFT.

I'm interested in detecting the apperarence of a certain frequency in the FFT, and call a function upon its appearence.

I presume I will do this if that frequency crosses a certain amplitude threshold in the FFT.

What's the best way to go about doing this?

 

cosmund

 

0 Kudos
Message 1 of 4
(3,265 Views)
Solution
Accepted by topic author cosmund

Hello cosmund,

 

The magnitude output of the Spectral Analysis Express VI is a cluster data type that includes the starting frequency (f0), the difference in frequency between two successive frequency points (df), and an array that contains all the magnitude points in the FFT (magnitude). To monitor a particular frequency of an incoming signal, you will need to extract these values.

 

To do this, you can use the Unbundle by Name VI that is found in the Cluster, Class, & Variant subpalette in the Programming palette. When you wire in a cluster datatype, you will be able to exact each of these three pieces of information by expanding the function and selecting the proper cluster elements. From the f0 and df values, you will be able to determine which index of the magnitude array contains the frequency you wish to monitor. Now you can use the Index Array function of the Array palette to read off the FFT magnitude at the frequency you wish to monitor.

 

To call a function based on the FFT magnitude, I would recommend using a case structure.

 

Hope this helps!

-Abram

Message 2 of 4
(3,239 Views)

Thanks for your inputs on this subject.

 

Now, how can I synchronize the FFT read with system time (absolute time)?

ie. is there any way for me to know the precise time at which the FFT was calculated?

This is important to me, because I need to know the exact time when a particular frequency appears in the spectrum.

 

Thanks.

0 Kudos
Message 3 of 4
(3,222 Views)

Hi cosmund,

 

The best way to find out when your FFT was calculated is to use the "Get Date/Time in Seconds" VI in the Programming»Timing palette. When this VI is executed, it will return a timestamp of the current time. You can force this VI to happen right before the FFT is taken by using a sequence structure. See the attached screenshot.

 

 

If you want to know the time when the frequncy showed up more presicely, you might want to consider using the Short Time Fourier Transform  (STFT). Ths function returns a 2D array that is indexed by both frequency and time.

 

-Abram

Message Edited by Abram R on 05-11-2009 12:28 PM
Message 4 of 4
(3,195 Views)