LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Build XY Graph Output to FFT?

Solved!
Go to solution

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?

 

jla3141_0-1626467347775.png

 

 

// PhD engineering, not an idiot, just new to LabVIEW, please be gentle 🙂 \\
0 Kudos
Message 1 of 22
(4,609 Views)

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.

Message 2 of 22
(4,557 Views)

See .vi attached. As mentioned in first post, the datapoints are periodically spaced.

 

Expectation is the FFT of:

jla3141_0-1626473727104.png

 

Resulting in spectra like:

jla3141_1-1626473746784.png

 

 

// PhD engineering, not an idiot, just new to LabVIEW, please be gentle 🙂 \\
0 Kudos
Message 3 of 22
(4,554 Views)

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?

0 Kudos
Message 4 of 22
(4,545 Views)

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

0 Kudos
Message 5 of 22
(4,533 Views)

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.

Doug
Enthusiast for LabVIEW, DAQmx, and Sound and Vibration
0 Kudos
Message 6 of 22
(4,526 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 22
(4,476 Views)

Charts make no sense for spectra. I am sure he meant to say graphs. (as in waveform graphs).

0 Kudos
Message 8 of 22
(4,464 Views)

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

0 Kudos
Message 9 of 22
(4,441 Views)

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.

// PhD engineering, not an idiot, just new to LabVIEW, please be gentle 🙂 \\
0 Kudos
Message 10 of 22
(4,436 Views)