07-16-2021 03:29 PM
I have a build XY graph where the X and Y inputs plot scalar values as they're sent to the graph. The graph outputs a 1D array of cluster of two elements. I am guessing that's somehting like [x0, y0; x1, y1; ... xn, yn;]. I want to take an FFT of this data.
I take the 1D array from XY graph and put it into an Index Array, and then unbundle it and FFT the Y component by sending it to the "signals" input of Spectral Measurements. I then put a waveform on "power spectrum" output of Spectral measurements. The result is not what I expect to see, though.
What's the best way to FFT a series of scalar values that are equi-spaced in distance/time, or failing that, FFT the output of a Build XY Graph?
Solved! Go to Solution.
07-16-2021 04:59 PM
Please attach your vi, not pictures. Typical FFT requires equally spaced time points. You can eliminate all your express vis and xy graphs and just do plain waveform graphs with customized x0 and dx.
If you get a result that you don't expect, tell us what you get and what you expect instead.
We'll give more detailed advice once we see the vi.
07-16-2021
05:12 PM
- last edited on
07-22-2021
09:21 AM
by
NI_Community_Su
See .vi attached. As mentioned in first post, the datapoints are periodically spaced.
Expectation is the FFT of:
Resulting in spectra like:
07-16-2021 05:42 PM - edited 07-17-2021 01:11 AM
OK, so you are using the express VIs to accumulate single points, one per iteration. Looks overly complicated. Can't you wait for all data to arrive and the do a FFT once?
Sorry, I am currently on a laptop and cannot efficiently inspect such a gigantic diagram. Maybe later....
I get the feeling that this entire thing could be done with 20% of the current code. Do you have some typical data?
07-16-2021 10:07 PM
A frequency spectrum is often presented as a Bode Plot, which plots the Frequency Axis on a logarithmic axis, spectral amplitude also on a logarithmic axis, and phase on a linear axis (again, with frequency on a logarithmic axis).
You should probably learn the difference between a LabVIEW Chart and the XY Graph. I would expect a Spectrum to be displayed on a Chart.
Bob Schor
07-16-2021 11:05 PM - edited 07-16-2021 11:08 PM
Instead of XY data, I recommend you use build waveform to bundle the timing information (specifically dt = time interval between samples) and the accumulated data array (Y = values of sampled signal). The waveform measurements palette has spectrum measurements VIs that operate on a time waveform and return a frequency spectrum that you can graph.
07-17-2021 07:06 AM
Hi Bob,
@Bob_Schor wrote:
You should probably learn the difference between a LabVIEW Chart and the XY Graph. I would expect a Spectrum to be displayed on a Chart.
Mind to explain why you expect to display spectra on charts? I usually use a (waveform) graph…
07-17-2021 09:36 AM
Charts make no sense for spectra. I am sure he meant to say graphs. (as in waveform graphs).
07-17-2021 02:38 PM
Duh! Of course, I must have (temporarily, I hope) turned my brain off. I verified that "Spectra are Graphs" by looking at a routine I wrote two years ago to analyze primate calls, plotting the Waveform and the Waveform Spectra as Graphs.
Bob (my apologies) Schor
07-17-2021 03:37 PM
Yes, I am OK with 'waiting' for all points to arrive before FFTing, it would be nice to have a continuous FFT on the points though.
And the vi is huge, I'm not a Labview programmer, only Python. I think it should be broken into sub-VIs but I haven't invested the time to do it. Large parts of it are copied from different manufacturer's solutions and then hacked/slashed together.
Attached the data I'd like to FFT.
I've attached some data, pertinent collums are X and T.