LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to perform FFT of discrete points using system time?

Hi all,

 

I have a while loop which currently performs a calculation and gives a value for capacitance (C) each loop. The waveform chart when I graph C shows a 1Hz sine with high frequencies on top. I want to be able to perform an FFT to see what the high frequencies are however I have run into a problem...I've tried inserting the C points into an array in the while loop and using 100 points at a time to build a waveform so that I can use the fft power spectrum and psd vi, however my dt would be different because it is dependent on how long it takes the spit out a C value so I've tried using the t0 parameter instead by using get date/time but that doesn't seem to give me the result I want.

 

Any ideas?

 

Thanks in advance!

 

Daniel

 

c_graph.PNG

 

fft_graph.PNG

 

while loop

 

0 Kudos
Message 1 of 4
(2,792 Views)

Daniel,

 

you have to provide the sampling rate into the dt parameter of the waveform. The t0 parameter has to be 0.

 

Cheers

Edgar

0 Kudos
Message 2 of 4
(2,746 Views)

Hi Edgar,

 

The problem I'm having is that C is not sampled, it merely outputed once each while loop, therefore dt would be changing depending on how long it took to loop each time? Therefore I've gone with using the timestamp, however it doesn't seem to be working properly when I use the get date/time as shown in the code.

 

Daniel

0 Kudos
Message 3 of 4
(2,720 Views)

Daniel,

 

of course it doesn't work this way. An FFT needs a constant sample rate. You can try to resample the waveform to get that. And I would recommend some reading about FFT, seems you have quite a lack of basic understanding of it.

 

Cheers

Edgar

0 Kudos
Message 4 of 4
(2,656 Views)