01-25-2013 07:14 AM
I have a 1D array of sine wave measurements. 1Khz, 1000 samples, 10000 samples per seconds. I need to determine the best way in CVI to analyze the array to determine the frequency. I was thinking about finding the peaks and recording the array location for each peak. Since the sampling rate is known I can determine the time between peaks and determine the frequency. Are there built in functions that will find peaks and give you the array location? or can I perfrom some sort of FFT analysis to determine the frequency?
01-25-2013 07:35 AM
Hi,
I have used the function ThresholdPeakDetector from the Advanced Analysis Library which returns the indices of peaks exceeding a certain threshold. There might be even better suited functions but I haven't used them
01-25-2013 08:09 AM
I will give it a try. I wrote my own quick and dirty peak detection algorithm. So far I'm about 1-3hz difference between my scope measurements and the daq card measurements. I'm currently using a signal generator which is a nice clean signal. I'm worried about measuring a live signal with noise riding on top of the signal.
01-25-2013 08:21 AM
Savitzky-Golay filtering may help here, CVI provides the function SavitzkyGolayFiltering, I used it with a polynomial order of 4.
01-25-2013 08:50 AM
Or perform a power FFT with Spectrum(), get the index position of the peak and multiply by the sampling frequency. It's a good method if it's noisy and if you need a precision of more than an integer multiple of the index freq, you can do a fit with a gaussian very near the peak.
01-25-2013 12:28 PM
I used the peak detect function and determined the frequency. Its accurate. I am having some noise issues. I am generating a tone while a device is recording the tone. I then play it back and use a microphone to measure the amplitude/freq. This is a go/no go production test to verify manufacturing hooked the microphone/speaker up correctly. My freq measurement seems ok but the voltage measurement is all over the place (background noise). I also noticed the peak detect function has a threshold. You need to determine what your peak value is initially to make it more accurate. I set the threshhold to .25 volts and it missed .36 peaks.
01-30-2013 04:19 PM
I use the power FFT spectrum(...) function as gdargaud suggested. With an NI DAQ card, you can create your own spectrum analyzer easily.
02-04-2013 06:21 AM
Are there any examples of this in CVI?
02-04-2013 06:40 AM
If you have the Advanced Analysis library installed you can consider e.g. spectrum.cws