LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read X values corresponding to Y peak value after FFT

Solved!
Go to solution

I have a program which takes an input waveform and applies a power fft to it in order to obtain the frequency spectrum. For a group project I need to obtain the frequency value at which the peak occurs (the X value on the top graph). I have tried using the GET XY control but I only need the X value outputted as a numeric value and not as a waveform. Can anyone help?

 

I currently have the input as a controllable sine wave so obviously I am able to control the frequency directly, however in the project this will be an EEG wave that I will have to calculate the frequency of.

Download All
0 Kudos
Message 1 of 6
(2,264 Views)
Solution
Accepted by topic author stefan_hr

Hi Stefan,

 

The PSD function gives yo a cluster containing f0, df and a frequency array:

  1. Find the position of the peak using ArrayMinMax, it will give you the index "i" of that value in the frequency array.
  2. Your desired frequency value is easily calculated by "freq = f0 + i × df"…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(2,261 Views)

Thank you so much for your help. How can i connect the output of the PSD to the ARRAY MIN MAX as it requires an array input and the output is a waveform.

0 Kudos
Message 3 of 6
(2,254 Views)
Solution
Accepted by topic author stefan_hr

Array Max & Min does not require a waveform.  It requires an "array".

 

Take the result from the FFT which is a cluster, and use Unbundle by Name to get the array out of it.

Message 4 of 6
(2,247 Views)

Hi Stefan,

 

I wrote "the output of PSD is a cluster containing…". Did you read my message?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(2,243 Views)

We have a group project and we have to read EEG data from a patient and using LabVIEW have to extract the frequency of the inputted data. In a previous example I was able to calculate the frequency when I inputted a noisy sine wave using the magnitude function from the power spectrum. However when we read data from the function generator the wires do not match up and we get an error that the array types are different even though the wiring has not changed.

 

Elvis final is the VI that is not working

Frequency Detector Rand is the working VI with the generated sine wave

 

Can anyone help please????

Download All
0 Kudos
Message 6 of 6
(2,070 Views)