From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Online and offline FFT analysis

Dear all,

 

I would like to perform an online and offline FFT analysis on accelerometer data that I have acquired.

 

I would be acquiring the data for quite a few hours. So I have decided to save the file in the TDMS file format.

 

I have no issue with recording the waveform and FFT spectrum.

 

The main problem that I am having is the offline post processing. That said, I made a simple VI to try out the zoom FFT. It seems to work fine for performing FFT on waveform of duration longer than 1second. However, when I would like to have the FFT of just a 1second slice of the entire recording, there is no FFT spectrum available for viewing. I am not sure if it is only me or am I doing things wrongly.

 

I've attached  the recording VI and playback VI.

 

A separate question is whether the VI that I did is actually doing what I want. For real time processing of data, from what I understand of FFT, it is that we are actually acquiring data at say 1000 samples and the data is being past into the FFT to generate a spectrum for that particular 1000 samples. Whether it is averaged or not, depends on the averaging parameter that we input into the FFT. If we do post processing on data that is logged for say 100 seconds, and we want to have the RMS averaged of the first 20 seconds or so, is it correct to say that we just have to wire in the recorded waveform of the first 20 seconds into the data input terminal and set the averaging to RMS averaging?

 

If I had acquired a longer duration of waveform (say 24 hrs) and I want the RMS average of the waveform. Is is possible to actually compute it out? I know that it would most likely cause our computers to crash. So I am thinking if it is alright to take the RMS average of say the last hour of the waveform to compute the RMS average of the waveform to give the estimate of the 24 hour duration waveform.

 

Much appreciated for the kind assistance to any kind souls answering my fundamental questions.

Download All
0 Kudos
Message 1 of 6
(3,792 Views)

Just to let you see that if i set the duration to 1 second, I have an empty FFT spectrum, here's a screenshot of the VI running.

 

In the 1Second.png, there is no FFT spectrum output while in the Morethan1Second.png, I've set the duration to longer than 1 second and there is no issue with the output.

Download All
0 Kudos
Message 2 of 6
(3,791 Views)

I have to look at my home labtop, I wrote something similar... using TDMS files, but I store new files every 30min.

But since I use the soundcard at home, I switched to spectrumlab 🙂

 

Posting  vis and data eases help a lot!

(You don't have to post hours of data, 10min for testing should be fine)

 

For data analyses have a look at the STFT examples.

 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 3 of 6
(3,733 Views)

Thanks for your reply. I'll check out the STFT function in LabVIEW.

 

Unfortunately, I can't attach the tdms file in the forum as it isn't a valid file format for the forum.

 

Here's the error from the forum.

 

  • The file does not have a valid extension for an attachment. jpg,gif,txt,xls,vi,zip,doc,llb,pdf,png,seq,c,h,cpp,cs,vb,ini,gz,ctl,scr,ico,tar,z,uir,vit,wsp,tsw,rtf,lvproj,xctl,lvlib,cfg,ppt,pps,lks,spy,bld,lep,xlt,xltx,dot,dotx,docx,xlsx,cap,tui,csv,seproj,vip,ogp,vipc,ms10,ms11,ewprj,log,vix,lvprojx are the valid extensions.

But you can obtain a sample using the record.vi that I've attach in the first post. It generates a random waveform and records them into a tdms file to allow me to test my VI.

0 Kudos
Message 4 of 6
(3,707 Views)

All the forum cares about is the file extension. Just call it a .vix (I've used that in the past for VI's when I needed) or something else which your computer won't know what to do with, so you won't automatically go into a reader program, and give directions for handling it in the post.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 5 of 6
(3,691 Views)

Dear all, I've worked out a little bit of the zoom FFT and figured out why the duration is insufficient.

 

The duration of the time data required to perform Zoom FFT in playback depends on the range of  frequencies of interest and the number of lines. And since I am getting a spectrogram, the time increment depends on the averaging parameter and overlap percentage. These values are programatically done by looping through a counter, which is severely slow and cumbersome. May I know if there is a more efficient algorithm to do this? Or better still, if there is a way to calculate these minimum numbers. It's purely to prevent the user from inputting a value too small such that no spectrum will be output.

 

I've attached a zip file of the time data. unzip it and just point the VI to the TDMS file

 

Thanks!

0 Kudos
Message 6 of 6
(3,648 Views)