LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

scan rate and samples for FFT affecting dt

Solved!
Go to solution

Hi,

 

I currently acquire data from an accelerometer and set the scan rate of the clock to 5120 S/s. I then use the Analog 1d Wfm Nchan N Samp to acquire 5120 samples and then use FFT analysis on it to create a frequency chart. This gives me a dt of 1 i.e. a resolution of 1Hz.

The question i have is how can i sample the data with a dt of 1 at a faster rate.

For example i change the scan rate to 10240 and still aquire the samples at 5120, this allows me to sample twice a second but gives me a dt of 2 (2 hz resolution) when i do my FFT analysis. All that happens by upping the scan rate for the sample clock is that i can now detect peaks at higher frequencies.

By this i mean if i just scan at 5120 S/s using my card , when i do the FFT it goes upto 1100Hz approx , if i double the scan rate, it then doubles this to 2200Hz approx, but then reduces the resolution

 

How can I improve the update speed and still keep a DT of 1?

 

Thanks

 

Mike

 

0 Kudos
Message 1 of 21
(3,686 Views)

The frequency bin spacing is gien by dF=Fsample/(number of samples).

You will find more info here http://zone.ni.com/devzone/cda/tut/p/id/4278



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 2 of 21
(3,678 Views)

Hi,

 

Yes i realise that but what i am effectively asking is how do i sample at a greater number of times a second but still keeping the dt (dF) as 1.

Because the sample rate is always stated in S/s, if you take less samples for your FFT you effectively increase your dF...while increasing your update rate

i.e. its impossible to have a dT of 1 unless you sample the data once per second.

Below is an image of how i acquire the data, hopefully this will make more sense.

If i sample the data at 10000S/s and then get 5000 samples i will get an update of 500ms on the screen but only a dF of 2 , i want to be able to have the screen update around 10Hz but still end up with a dF of 1 how do i do this?

 

Thanks

 

Mike

 

 

scanrate.jpg

 

0 Kudos
Message 3 of 21
(3,664 Views)
Why must dF be 1? You do know you can scale the Xaxis to show correct numbers for all dF values you might have


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 4 of 21
(3,650 Views)

Hi, yes i do scale it up already on the axis so its not a problem on that side.

Just i'd like to be able to log the data around 5hz for the customer and keep a 1 hz resolution when i plot it, it seems this is not possible then?

 

It seems we are saying that the only way to keep a 1hz (dF = 1) resolution is to only sample the data once per second?

0 Kudos
Message 5 of 21
(3,645 Views)
Yes as mentioned before, the dF is depended on both sample rate, and mumber of samples. So if the sample rate is set, your update rate(by number of samples) will determine the dF.


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 6 of 21
(3,639 Views)

The size of the dataset you send to the FFT does not need to be the same size you acquire.  Use a shift register or an Action Engine VI as a circular buffer to accumulate 1 second of data.  So it works like this:

 

1. Acquire 0.2 seconds of data.

2. Save the newly acquired data to file.

3. Append newly acquired data to circular buffer and remove any data older than one second.

4. Repeat 1, 2, 3 five times (total = 1 second).

5. Send the data in the circular buffer (1 second of data) to the FFT.

6. Graph output of FFT.

7. Go to 1.

 

Lynn 

0 Kudos
Message 7 of 21
(3,627 Views)

Hi,

 

Unfortunately i dont think i am quite making clear what i mean

 

Apologies so I'll try again..... 

  

If I aquire the data at 5600S/s and my number of samples is also 5600. When i do the FFT peak spectrol measurements my df would then be equal to 1. By this as i understand it, it means i have a resolution of 1Hz on my FFT graph/data.

This is all fine, but if i want to update the graph or indeed save the data to disk at say 5Hz how do i do this and still keep the resolution of the FFT at 1Hz??.

If i change the S/s for the clock, all this does is increase the frequency range it does its aquiring over in the FFT. i.e. if its 5600 S/s my FFT goes upto 2550Hz on its X axis. If i up it to 10200 S/s my FFT goes upto 5100Hz on its X-Axis.

Therefore if i keep the same samples in my aquiring waveform i would get it to run at twice a second if my sampling rate was 10200 and my samples were 5100, BUT my resolution would go down to 2 on the FFT chart.

How can i sample at a faster rate at the frequencies i want yet still keep the reolution to 1 on the FFT?, i almost want to set the sampling rate per 10th of a second i suppose to enable me to update at a faster rate but this isn't possible - is it?

 

Many thanks

 

Mike

 

0 Kudos
Message 8 of 21
(3,623 Views)

Mike,

 

To keep the math simple I am going to use a nominal sampling rate of 5000 samples per second.  I presume that this meets the Nyquist criterion for your signal.

 

All samples are taken at 5000 S/s.

Acquire 1000 samples at a time (0.2 seconds). Save the current 1000 samples to the file. 2 ms resolution, 5 Hz update rate. 

Accumulate 5000 samples (in circular buffer) = 5 acquisitions.

Do FFT on 5000 samples in buffer and plot on graph.  1 Hz resolution, 1 second update rate.

 

To implement this, use a case structure inside the loop. The FFT case runs once every five iterations of the loop. The other case might be empty except for passing data through. The acquisition and save code runs on every iteration.

 

I would probably do the saving in a parallel loop to avoid potential problems with OS and hard drive latencies, but get the basic concept down first before worrying about things like that.

 

Lynn 

0 Kudos
Message 9 of 21
(3,617 Views)

Hi again,

 

Thanks for your quick reply.

Basically the saved file then would have .2s resolution like you said, so if anyone wished to load the data back up and perform an FFT on it it would just be 5Hz

 

This may be my lack of understanding of FFT, but basically the answer is that if you want 1Hz resolution on an FFT plot you can only update that FFT once per second? sort of makes sense when i say it like that, but i've seen other vibration packages that seem to update the FFT display many times per second as its sampling.

 

Could you just confirm this please

 

Ta

 

Mike

 

 

0 Kudos
Message 10 of 21
(3,605 Views)