LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I get an FFT from this?

I am doing DAQ uaing AI S-scan.vi and wanted to know if I can take the output from it and make a power specturm. I know I can do it using AI Continuous input.vi, but the input from that is buffered so it comes out in chunks and so S-scan is preferable if it works. Any help would be much appreciated. Thanks.
Intern NSWCCD Carderock.
0 Kudos
Message 1 of 10
(3,636 Views)
Anyone know if it is possible?
Intern NSWCCD Carderock.
0 Kudos
Message 2 of 10
(3,618 Views)
I don't believe there is a problem other than there is an implicit assumtion that the samples are taken at exactly the same sample intervals.

Can you guarantee that with the single point aquisition?

If you can't then you will get poor quality results.

P.S.
I note that you haven't rated a single answer yet..... Lets hope this is one of the first.
Message 3 of 10
(3,604 Views)
A single scan is just that, a single scan. It is an array because it represents one reading from each of your configured channels, so if you have 5 channels configured it will return a 1X5 array. It is _really_ hard to do an FFT on one data element, although strictly speaking it does fulfill the "power of 2" requirement that I mentioned in an earlier post. I don't know why you can't use the continuous and sample the returned data. Even a standalone Spectrum Analyzer doesn't give a "continuous" display, rather is sweeps across, building the displayed image (as its internal filter sweeps across the frequencies being display). Have the AI in one loop, write the data into a LV2 style global which is then read in the loop with the FFT math/display. Have the buffered data being read in by the AI large enough for a reasonable FFT and ...


P.M.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Message 4 of 10
(3,600 Views)
Since you are handing you data to a chart, it seems your data is arriving continuously. Are you looking for a fourier transform of the final data or some realtime display of fourier transform of a windowed section of recent history data or even a 2D display similar to JTFA?

LabVIEW can definitely do all these possibilities. Just tell us what you want. 🙂

(btw, you're doing some weird NO-OPs, like reshaping an array to it's own lenght ;))
0 Kudos
Message 5 of 10
(3,598 Views)
I actually want to read in the data at real time and then store a set of points to an array then do an FFT on it and then keep doing this. I guess this will make my time domain graph seem almost real time and the FFT will run independantly. Is this possible, and if so could anyone help me on how to do it? Thanks a lot for all the help!
Intern NSWCCD Carderock.
0 Kudos
Message 6 of 10
(3,587 Views)
I think I got somewhere on it, but I'm still having problems. I can get a peak at the right frequency up to about 600htz but for freq. above that it does not work. Not sure what I'm doing wrong. I have attached the program, any help is appreciated. Thanks a lot.
Intern NSWCCD Carderock.
0 Kudos
Message 7 of 10
(3,565 Views)
How many channels of data are you expecting? What are you expecting to happen with a one dimension array passed through the reshape? The data coming out of a single scan is a 1 X # channels array, so what you are plotting now appears to be a graph of all the channels or if you have only one channel then it is building a graph, using the graph's history feature, of your signal. If you build a LV2 style global (see other threads) and pass the data from each acquisition into it, you can build up an array and you can monitor it in another loop with your FFT math. When the LV2 array reaches the appropriate size (a power of 2 in the #of samples dimension) you can have it signal the FFT math loop to do its thing. This could be just a data size value fed into the LV2 global, and a boolean that shows true when the correct size array is created. You can then "flush" the LV2's data (read it all out) and the DAQ loop will start building it again. You will have the time domain displaying continuously, the FFT each time it gets enough data.


Attached is a really quick, and dirty, example. If haven't tested it with DAQ hdw, the LV2 global should work though.

It is in LabVIEW 7.1

P.M.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Message 8 of 10
(3,563 Views)
I was writing my last post as you were posting yours. One of your limits, as max frequency is concerned, is your scan rate. If you are performing a continous scan you define the scan rate, which is the most important limiting factor in performing an FFT as the max frequency that can be correctly displayed by an FFT will <2Xscan rate (the Nyquist Freq). In your code the scan rate is determined by how fast the loop will execute, which is limited by: the AI initializtion (this does not need to be performed every loop, so move it outside), how long the actual AI takes to return its data, how long the FFT math stuff takes. These are all unknowns and worse, variable, so you won't know what your max freq allowed will be from moment to moment. With the continous scan type of DAQ you have a lot more control of that. The example that I sent you, a modified version of your original code, has part of the same issue, as the DAQ loop speed is mostly governed by how fast the DAQ AI takes. Using the LV2 global concept (or some other message/data passing techniques) allows you to move possibly time consumptive stuff out of your more time critical loops. If you go to the continuous scan, writing to a LV2 global, you can let the hardware aquire data at a predefined rate and display/manipulate it in another loop. Your time domain display will be updated in "chunks", but if you make the continous scan sample length relatively short it won't "blink" too much.

The example I attached to the previous post can be modified fairly easily by changing the insert into array and making the index increment based on the length of the new data.

P.M.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 9 of 10
(3,558 Views)
I have been working on a similar vi with Labview v6.1. Would it be possible to send me the vi saved as version 6.1?
I found the Benchtop Specturm Analyzer example a big help.
Thanks.
0 Kudos
Message 10 of 10
(3,527 Views)