10-29-2018 11:43 AM
Hi All,
I would like to generate a power spectrum of some data, for example, I have some data collected from "DAQmx Create Virtual Channel (VI)" (AI Accelerometer) for 5 seconds, and I want to generate the power spectrum for the entire 5 seconds. However, the "FFT Power Spectrum VI" or "Spectral Measurements Express VI" seems only perform the power spectrum for a limited data sample or a extremely short period of time. Is there a way to alter this setting?
Really appreciated for any suggestion.
Drake
Solved! Go to Solution.
10-29-2018 01:11 PM
10-29-2018 08:38 PM
Hi GerdW,
Please find attached VI (V17). Can you elaborate a little more about how to set the indicator to default?
Thank you,
Drake
10-29-2018 08:52 PM
When you run your VI, Controls or Indicators may take on values (for example, you read a file and save the data in an Array), or you key in some values into controls, then run the VI with those values. When your VI has values that you'd like to "save as Default" (so that you can send both the VI and "typical data" to the Forum, for example), simply click on the Edit menu, choose "Make Current Values Default", and save the VI (with the Current Values now being Default). Now attach your VI to your Forum Post, and send the VI with data for us to examine.
Bob Schor
10-30-2018 08:28 PM
Hi Bob,
This is a nice function. Please see attached VI with typical data. I also included a picture of the front panel and the data collected for the acceleration and FFT.
Thank you,
Drake
10-31-2018 01:58 AM - edited 10-31-2018 02:01 AM
Hi Drake,
the "FFT Power Spectrum VI" or "Spectral Measurements Express VI" seems only perform the power spectrum for a limited data sample or a extremely short period of time.
Those functions do EXACTLY what you have programmed them to do…
In the loop you are reading 1000 samples (10kS/s sample rate, divided by 10). With those 1000 samples you are calling the FFT functions. Why do you think the functions do work with limited set of data?
Is there a way to alter this setting?
Sure!
Collect 50000 samples when you want to analyze data for a period of 5s.
Either read 50000 samples at once (might give a bad UX) or collect the data of 50 iteration of your current loop…
On your VI:
Your initialization loop is somewhat buggy:
- you can define the number of channels
- you autoindex an array of coefficients (ai0 to ai2) with just 3 entries!
- you autoindex an array of sensor lables with 8 entries, 4 of them being empty strings…
This combination of inputs will only work for a limited amount of sensors…
11-01-2018 12:50 AM
Thank you for your explanation, GerdW. It makes sense to me now.
I agree with you that my initialization loop is somewhat buggy. I was trying to limit to 3 sensors for now (add more if needed in the further). In the beginning, I was trying to hide/gray out other ai slots if the number of sensors is not entered (eg. if the number of sensor is entered "1", then ai1 and ai2 will be grayed out). Yet, this doesn't work because the user needs to run the VI in order to execute the action. Do you happen to have a suggestion for this?
Thank you,
Drake
11-01-2018 02:10 AM
Hi Drakelau,
Do you happen to have a suggestion for this?
Sure - almost all programs with a UI need to handle situations like this…
What about a (while) loop to handle UI actions before the initialization state?
What about a state machine handling each step/state in your program, from user input to init to measurement?
11-01-2018 10:51 PM
Thank you GerdW. That might actually work. I will look more into that.
Best,
Drake